Call VBA procedure ilocated in another workbook

  • Thread starter Thread starter oleg.melentyev
  • Start date Start date
O

oleg.melentyev

Hi - is there a way to call an Excel VBA procedure located in another
workbook? Thanks!
 
Yes. BUT, the other workbook must also be opened in Excel for this to work.

Now, if the other workbook is not yet open, Excel will attempt to open it.
If it doesn't find the workbook, you get an error message. If Excel does
find the workbook and successfully opens it, the workbook_open or auto_open
procedures will also execute.


This will run the procedure named "Test" that's inside a module in Book1.xls

Application.Run "Book1.xls!Test"


This will run the procedure named "Test" that's inside Sheet1 of Book1.xls

Application.Run "Book1.xls!Sheet1.Test"
 

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