Error querying for open VBprojects in XP?

  • Thread starter Thread starter Arne
  • Start date Start date
A

Arne

An add-in of mine checks to see whether an add-in is
installed OR loaded, since it will work in both cases. To
see whether the add-in is loaded, I use

Dim AddInLoaded As Boolean
Dim p As Object
AddInLoaded = False
For Each p In Application.VBE.VBProjects
AddInLoaded = AddInLoaded Or (p.Name = "MyAddInName")
Next p

This worked fine with Excel97 and Excel2000, but I get a
run-time error 1004 in the latest Excel versions:
something to do with accessing projects from within a
project. Is there a way to get around this that will work
with the older XL-versions as well?

TIA, Arne
 
Does that 1004 say:
"Programmatic access to Visual Basic Project is not trusted"?

If yes, then you're getting stopped by a user setting. You can change yours by:

Tools|macros|security|Trusted sources tab

check "Trust access to Visual Basic Project"

This is a user by user change--not something you can change in your code.
 
-----Original Message-----
Does that 1004 say:
"Programmatic access to Visual Basic Project is not
trusted"?

Indeed it did say that, beit in another language :-)
If yes, then you're getting stopped by a user setting. You can change yours by:

Tools|macros|security|Trusted sources tab

check "Trust access to Visual Basic Project"

This is a user by user change--not something you can change in your code.

Thanks for the help.

Arne
 
Back
Top