View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Call to Sub Routine which exists in seperate workbook

Another way is to open the other workbook and call the macro using
application.run (instead of the reference):

Dim OtherWkbk as workbook
set otherwkbk = nothing
on error resume next
set otherwkbk = workbooks("somename.xls") '<-- no drive, no path
on error goto 0

if otherwkbk is nothing then
'it's not open, so open it
set otherwkbk = workbooks.open("C:\folderhere\somenamehere.xls")
end if

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



Coby wrote:

If I had one workbook open, but the vba modules were in another
workbook which is closed, does anyone know if there is a way for the
codeless workbook to run the subroutine which is in the other
workbook?

Any help is sincerely appreciated.

Coby.


--

Dave Peterson