VBA to find out if macros are enabled in a file?

krisbee2000

New Member
Joined
Apr 14, 2011
Messages
1
Okay, we have a very complicated excel file/program that we use at work, and it has a main excel file that we use to open its' data files. Some of these data files have macros in them.

All people use the master program, hit a button that triggers a subroutine to open the data file with all of the pertinent info. After opening, the open routine verifies it is a valid data file and not some random excel file, then triggers an update subroutine that will run other subroutines that update information, formulas, etc.

Now, here is the problem. If there is a macro in the data file(which is almost all), the security warning shows up in the ribbon, and then the master subroutines just doesn't care and plows ahead which causes the updates to fail miserabley (sometimes hundreds of lines of codes and updates). The end user will be confused, and this is not good.

If the data file is in a trusted location, no problem, but I can't guarantee that for two hundred employees, and things happen...

So, if I run the routine from the VBA editor, a nice big warning comes about a potential security concern, do I want to enable or disable. If I disable, everything stops, which is fantastic. If I enable, problem solved which is also fantastic.

I don't know why running the same routine from a worksheet shows a different type of warning than running from the editor - however, here are the questions/solutions...

1. Get the same nice enable/disable warning, put that in the open subroutine and this will solve everything.

2. Find out if the file that is being opened has a security issue, if does, wait until it is resolved.

Any help would be greatly appreciated!
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,224,586
Messages
6,179,719
Members
452,939
Latest member
WCrawford

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