Update from Excel 97 to 2007

  • Thread starter Thread starter Joakim Norrman
  • Start date Start date
J

Joakim Norrman

I have recently upgraded to Excel 2007 from Excel 97 and following code is
not working in Excel 2007:

Sub Test()
'Get name of active VB project
MsgBox Application.VBE.ActiveVBProject.Name
End Sub
 
Hi,

That code works for me in 2007. I did have to allow access to VB
projects first in order to avoid the warning message.

Office button > Excel Options > Trust Center > Trust Center Settings >
Macro Settings > Developer Macro Settings > Trust access to the VBA
project object model.

If not this can you give details of the actual error or what does not work?

Cheers
Andy
 
This is a security thing, not an Excel 2007 thing.

It doesn't work in 2003 or 2002 unless you follow Andy's reply and allow VBA
access to VB Projects. In 2003: Tools menu > Macro > Security > Trusted
Publishers tab, check the checkbox.

- Jon
 
Thanks Andy.
Works fine now.

Andy Pope said:
Hi,

That code works for me in 2007. I did have to allow access to VB
projects first in order to avoid the warning message.

Office button > Excel Options > Trust Center > Trust Center Settings >
Macro Settings > Developer Macro Settings > Trust access to the VBA
project object model.

If not this can you give details of the actual error or what does not work?

Cheers
Andy
 
Back
Top