View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_3_] Bob Phillips[_3_] is offline
external usenet poster
 
Posts: 2,420
Default SIMPLE way to call code in one XLA from another?

Set a reference in ToolsReferences to the other XLA, It is then a directly
callable procedure.

--
__________________________________
HTH

Bob

"Maury Markowitz" wrote in message
...
I'm trying to greatly reduce the amount of code that is copied into
various VBA containers but is otherwise identical. This includes
things like calculating holidays, figuring out who the user is, and
various utilities like "WorksheetExists". I've given up on trying to
make a truly universal one that will work in Excel and Access (am I
missing something?) so for now I'm concentrating on Excel.

I have about 20 modules in one huge code library. I want to break this
down, and move all the truly generic utility code into a new XLA
called, oddly enough, "Generic". This code rarely changed. That code
will then be called from another broken-out library called
"accounting". This code changes much more often.

The problem is that, from what I can see, subs and functions in one
XLA are invisible to another. I have seen code for calling it using
RUN, but that is extremely ugly. Is there some other way to more
directly call another module, like...

Generic.WorksheetExists("myWorksheet")

Maury