Open a workbook from VBA and disable Workbook_Open() code?

calendar_today Asked Apr 30, 2013
thumb_up 5 upvotes
history Updated April 16, 2026

Question posted 2013 · +5 upvotes

I am opening spreadsheets using VBA and a couple of the workbooks contain code which starts executing when Workbook_Open() is called.

How can I open the workbooks using VBA but stop the code automatically executing? I am only opening the workbooks to look at formulae in the sheet- I do not want any code execution.

Accepted answer +5 upvotes

Would you like to try disabling the Events before you open the workbook in VBA and then re-enabling them for the rest of the module? Try using something like this:

Application.EnableEvents = False   'disable Events
workbooks.Open "WORKBOOKPATH"      'open workbook in question
Application.EnableEvents = True    'enable Events

Top excel-vba Q&A (6)

+5 upvotes ranks this answer #124 out of 136 excel-vba solutions on this site .