Macro in 2nd Open workbook

S

Steve

Is it possible to open Workbook1 with macros allowed but then open Workbook2,
from within Workbook1, but with macros disabled? I really only am trying to
copy data from Workbook2 to Workbook1 and don't need the "Open workbook"
macro to run in Workbook2. It just really slows down the copy process
 
D

Dave Peterson

You can disable events before you open the second workbook to prevent the
workbook_open from firing:

Dim wkbk1 as workbook
dim wkbk2 as workbook

set wkbk1 = workbooks.open(filename:=....)

application.enableevents = false
set wkbk2 = workbooks.open(filename:=....)
application.enableevents = true

Depending on what you're doing, you may want to turn off events before you do
anything with that second workbook to keep all events from firing in that
workbook.
 

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

Top