PDA

View Full Version : Stop code from running when opening



Djblois
03-29-2010, 08:37 AM
I have some code in Workbook A that will Open Workbook B. It opens Workbook B without a problem. However, Workbook B has code to run upon opening, so when Workbook A opens Workbook B, Workbook B's code runs. How do I stop Workbook B's code from running. Yes Workbook B's code is in the workbook_open event and I cannot remove it from there.

mbarron
03-29-2010, 09:30 AM
Use Application.EnableEvents=False before opening the B workbook, then turning Events back on after the workbook is open.

Application.EnableEvents = False
Workbooks.Open Filename:="C:\test.xlsm"
Application.EnableEvents = True