Running code in opened workbook

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

Guest

I have an Excel application that during running opens another workbook which
has some VBA code. How can I run the code in this opened workbook?

At present my application workbook shows a 'sub or function not defined
error when I try to run the code.

' code in my first workbook
Sub ProcessOtherWorkBook

Workbooks.Open Filename:="C:\Accounts.xls"

Call ProcessAccounts <== error here sub or function not defined

End Sub


Cheers
 
Sub pow()
Workbooks.Open Filename:="yourfilename.xls"
Application.Run ("yourfilename.xls!yourmacroname")
End Sub
 
Thanks Don, simple when you know how!!

Don Guillett said:
Sub pow()
Workbooks.Open Filename:="yourfilename.xls"
Application.Run ("yourfilename.xls!yourmacroname")
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
 

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