B
Bob
I've seen newsgroup messages back to 1999 trying to deal
with the problem where the CodeName property returns a
blank string unless the VBE gets "invoked" by one means
or another.
One of the simples solutions I've seen suggested fixing
this problem by simply making a reference to the
VBProject object as shown below:
Sub GetCodeName()
' Uncomment these two lines and .CodeName works
' because the VBProject object gets referenced.
'Dim s As String
's = ActiveWorkbook.VBProject.Name
MsgBox "CodeName = " & ActiveSheet.CodeName
End Sub
However, in Excel 2002 (and higher I assume) any
reference to the VBProject object results in the
error "Programmatic access to Visual Basic Project is not
trusted". You can make this error go away by enabling
Tools > Macros > Security > Trusted Souces > Trust access
to Visual Basic Project.
Here's the problem. I must use the CodeName property in
my Add-In that needs to work in Excel 2000 and higher. I
really do not want to have to require the user to
enable "Trust access to Visual Basic Project" in order
for my Add-In to work properly on Excel 2002 and higher.
Help! Does anyone have a solution for me?
with the problem where the CodeName property returns a
blank string unless the VBE gets "invoked" by one means
or another.
One of the simples solutions I've seen suggested fixing
this problem by simply making a reference to the
VBProject object as shown below:
Sub GetCodeName()
' Uncomment these two lines and .CodeName works
' because the VBProject object gets referenced.
'Dim s As String
's = ActiveWorkbook.VBProject.Name
MsgBox "CodeName = " & ActiveSheet.CodeName
End Sub
However, in Excel 2002 (and higher I assume) any
reference to the VBProject object results in the
error "Programmatic access to Visual Basic Project is not
trusted". You can make this error go away by enabling
Tools > Macros > Security > Trusted Souces > Trust access
to Visual Basic Project.
Here's the problem. I must use the CodeName property in
my Add-In that needs to work in Excel 2000 and higher. I
really do not want to have to require the user to
enable "Trust access to Visual Basic Project" in order
for my Add-In to work properly on Excel 2002 and higher.
Help! Does anyone have a solution for me?