Calling a Sub in Personal.xls

  • Thread starter Thread starter Jim Parsells
  • Start date Start date
J

Jim Parsells

I just can't find the right syntax.
In some workbook, I wish to call a Sub in my Personal.xls. Personal.xls is
loaded, of course, and I can use its Macros from any workbook while in Excel.
However, I cant find the right syntax to refer to Subs in that workbook from
VBA.

Help,
 
Nevermind --- someday I'll learn which search terms will get me what I need.
Just in case someone else wants this --

KeyVal = Application.Run("Personal.xls!SomeFunction", KeyVal, 2, 0)

You best be calling a function, because Application.Run turns all ByRef
parameters into ByVal, so you won't be returning a value in one of the
parameters.
 
Another option is to change the personal.xls project's name (from the generic
VBAProject) if you haven't already.

(and save your personal.xls with that new project name.)

Then use:
Select the other workbook's project.
Tools|References
and create a reference to your personal.xls project.

Then you can use the UDF just like it was built into excel:

keyval = somefunction(keyval, 2, 0)
 

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

Back
Top