MACRO

  • Thread starter Thread starter Rpettis31
  • Start date Start date
R

Rpettis31

Is there a way to activate macros from different workbooks. I have several
workbooks I update in the am and was wondering if there was a way to have an
update workbook so to speak and update all the other workbooks from the main
workbook.

Thanks
 
This is what I have and keep gettin a runtime 1004 error.
Application.Run ("G:\Receiving\Hot Containers.xls!teresa")
 
The workbook with the macro has to be open.

Dim HotWkbk as workbook
dim HotWkbkWasOpen as boolean
set hotwkbk = nothing
on error resume next
set hotwkbk = workbooks("hot containers.xls")
on error goto 0

hotwkbkwasopen = true
if hotwkbk is nothing then
'it's not open, so open it.
'no checks here--you should add some
set hotwkbk = workbooks.open(filename:="g:\receiving\hot containers.xls")
hotwkbkwasopen = false
end if

application.run "'" & wkbk.name & "'!teresa"

if hotwkbkwasopen then
'leave it open
else
hotwkbk.close savechanges:=false
end if

===
Untested, uncompiled--watch for typos.
 

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