pubert
Computer
- Aug 11, 2005
- 1
I am opening an Excel Workbook via VBA and the workbook I am opening has Workbook_Open Event. How do I bypass the Workbook_Open event in code when opening the workbook in code?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub OpenSecondaryWkb()
Dim Wkb As Workbook
Dim Path as String
Path = ThisWorkbook.Path & "\" 'for example
Set Wkb = Workbooks.Open(Path & "Workbook_To_Open.xls")
[b]Wkb.RunAutoMacros xlAutoOpen[/b]
'...
Set Wkb = Nothing
End Sub
Sub OpenSecondaryWkb()
Dim Wkb As Workbook
Dim Path as String
On Error Resume Next
Path = ThisWorkbook.Path & "\" 'for example
[highlight]Application.EnableEvents = False[/highlight]
Set Wkb = Workbooks.Open(Path & "Workbook_To_Open.xls")
[highlight]Application.EnableEvents = True[/highlight]
'...
Set Wkb = Nothing
End Sub