Running Macros

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

I am relatively new to VBA in Excel and am having trouble.
I am trying to call a macro in another workbook and pass a
parameter to that macro. Help does not provide a
reasonable explanation or Example to follow. I would
appreciate any help I can get in solving this problem!

TIA

Steve
 
hi,
is the other workbook open. if not then the macro will be
unavailable.
if is is open then try activing the workbook before you
pass the parameter to it.

workbooks(workbookname.xls).activate
 
I tried this and am still having trouble. I have been
opening the file with the following:

Workbooks.Open fileName:="c:\dirName\filename"

This works to open the file. When I try the
application.run command, I get a run time error (1004):
Method 'Run' of object '_Application' failed

Thankyou in advance fore your help!

Steve
 
When I do open the file first using the workbooks.open
command I get a run-time error 9, Subscript out of Range
error when the workbooks(filename).activate command is
issued.

I know this probably is not as hard as it appears, but
none of the resources I have available provide a clear
example of what I need to do. I know my problem has to be
syntax, but MS Excel help and one other resource I have at
hand do not provide any real help!

Frustrated! Help!

Thanks!

Steve
 
How about:

dim wkbk as workbook
set wkbk = workbooks.open(filename:="c:\...\macro.xls")
Application.Run "'" & wkbk.Name & "'!module1.macro1"
 
Thankyou! That helps a lot!!!
-----Original Message-----
How about:

dim wkbk as workbook
set wkbk = workbooks.open(filename:="c:\...\macro.xls")
Application.Run "'" & wkbk.Name & "'!module1.macro1"




--

Dave Peterson
(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