View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Darren Hill Darren Hill is offline
external usenet poster
 
Posts: 47
Default How to make Class Module universal

I've now tried that, and it give me "Error 2023" - whatever that means!

However, in a flash of inspiration I found something that works: using
the Parent property.

Thanks for your help.
Darren

Bill Renaud wrote:
I tried it inside a class module of mine that processes firewall log data,
and it seems to work, but you might be correct in that it might not work
for forms.

Try:

Dim varCaller as Variant

varCaller = Application.Caller

Set a breakpoint right after the final line above, then inspect varCaller
in the Locals window to see what you get.

Visual Basic Help for the Caller Property only lists a few types of
callers, and says an error is returned for any other type not listed, but
maybe this information is incomplete. (I am running Excel 2000.)

I know it will work for a macro called from a CommandBar button, as
varCaller returns a 2 element array, one element gives the button number,
and the other element lists the name of the CommandBar.