Disable an OpenWorkbook macro

brucesw

Active Member
Joined
Nov 12, 2002
Messages
304
Office Version
  1. 365
Platform
  1. Windows
I have a macro that searches for text in a number of network filese.

The files have an Open Workbook macro which hides all sheets. I don't want the hide-sheets macro to run when I run my search macro. Anyway to disable macros in a workbook being opened by another macro?

The unhide option apprears to be password protected when I right-click the sheet tabs.

Thanks,

Bruce
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Like this?

Application.EnableEvents = False

But why is the fact that the sheets are hidden preventing you from searching? You don't have to Select or Activate a worksheet to Find text on it.
 
Upvote 0
Thanks for the quick response.

I should have said that all the data I'm looking for is in the hidden sheets and Find will not show the result from a hidden sheet.

EnableEvents will not prevent me being asked if I want to Enable or Disable Macros on openning the file. If I disable upon openning then all sheets are unhidden and the search will work manually.When I click disable on openning the workbook, it stops my macro too.

It's a little more complicated than i thought. thanks for any help you can offer.
 
Upvote 0
I've found it:
Application.AutomationSecurity = msoAutomationSecurityForceDisable
 
Upvote 0
If you put this in your code before the line that opens the workbook:

Application.EnableEvents = False

the Workbook_Open procedure won't run.
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,841
Members
452,948
Latest member
UsmanAli786

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