Update from Excel 97 to 2007

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
 
A

Andy Pope

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
 
J

Jon Peltier

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
 
J

Joakim Norrman

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top