Thread: Auto run macro
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Auto run macro

Inside the second workbook's project:

Dim OtherWkbk as workbook
set otherwkbk = workbooks("otherworkbookname.xls") '<-- it has to be open
application.run "'" & otherwkbk.name & "'!somemacronamehere"

or

application.run "'" & otherwkbk.name & "'!somemacronamehere", myargument

or to return something:

dim resp as long 'or string or whatever
resp = application.run("'" & otherwkbk.name & "'!somemacronamehere", _
myargument)


March wrote:

Dear All,

I want to run automated macro in two workbooks. I means I have two workbooks
one centain macro and another one does not for now.

For the second one, I want to write VBA to call the Macro function from the
first one. I don't know what should I start now.

Please give me suggestion.

Thanks,

March


--

Dave Peterson