VBA to open a workbook without triggering open event?

Richard U

Active Member
Joined
Feb 14, 2006
Messages
406
Office Version
  1. 365
  2. 2016
  3. 2010
  4. 2007
Platform
  1. Windows
With office 365 on the horizon, I need to catalogue all of our spreadsheets, and identify links.

I am doing this by creating a workbook object, setting the object to"

Code:
Set wb = Workbooks.Open(path & file)
var_Links = wb.LinkSources(xlExcelLinks) 'set variant = excel links

This works great until I hit a few tools that have Workbook_Open events where the macros start executing.

Is there any way to suppress the events when opening the new workbook?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Try
Code:
Application.EnableEvents = False
Set wb = Workbooks.Open(path & file)
Application.EnableEvents = True
var_Links = wb.LinkSources(xlExcelLinks) 'set variant = excel links
 
Upvote 0

Forum statistics

Threads
1,223,162
Messages
6,170,431
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top