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)
- How to clear the entire array? +58 (2010)
- How to change Format of a Cell to Text using VBA +55 (2011)
- Download attachment from Outlook and Open in Excel +43 (2012)
- Can a VBA function in Excel return a range? +36 (2009)
- 2 Dimensional array from range +34 (2013)
- Hiding an Excel worksheet with VBA +33 (2009)
excel-vba solutions on this site
.