Calling procedures of a different project

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have different VBA procedures in different workbooks and I need to call a
procedure from one workbook to another. How can I do this? How is the right
syntaxis?

I appreciate any help.
 
Application.Run "'another book2.xls'!test_msgbox"

as an example

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Another method is to set a reference from the workbook that needs to call
the function to the workbook that contains the function. In the VBA editor,
open the workbook that contains the functions. Go to the Tools menu and
choose "VBA Project Properties". In that dialog, change the name from
"VBAProject"
to something meaningful, like "MyFunctions". Save that workbook. Then open
the workbook that is going call upon the functions, go to the Tools menu,
choose References, and select "MyFunctions" in the list.

Once you have that reference in place, you can call functions in the
"MyFunctions" project as if they were native VBA functions, without any
qualifiers.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting
www.cpearson.com
(email on the web site)
 

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