How to Check Macro Security Setting?

Niranjan

New Member
Joined
Mar 15, 2002
Messages
4
Hi
I have to distribute an Excel File containing macros to various users.
How can i make the file/macro check macro security setting of the users machine and advise him to enable macros otherwise the macros in the distributed excel file will not work.
Can anyone please help.
Niranjan
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
You can't. If the user has blocked macros, you can't have a macro run automatically to check settings (the whole point of blocking macros is not having macros doing things automatically). I would therefore advise the following.

When closing the workbook, have the auto_close macro select a separate sheet before saving, which contains the warning you wish to give new users. By selecting the sheet before saving, you make sure the sheet is active when a user opens the workbook.
If the user has macros enabled, you can have the "Auto_open" macro select another sheet immediately, so the warning disappears.

I hope this will help.

Marc
 
Upvote 0
Here's a small improvement. Use the Workbook_BeforeSave event instead of Auto_Close to do the trick. This allows the user to close the workbook without saving. The Workbook_BeforeSave event should be placed in the code of the workbook object, which you can access by right-clicking on the Excel symbol left of the "File" menu option, and selecting "View Code".

Place the following code:
Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
        Cancel As Boolean)
   Worksheets("Warning").Activate
End Sub
Where "Warning" should be replaced with the corresponding sheet name in your workbook.

Marc
 
Upvote 0
Hi
If your code has part in the integrity of your data, formats, ect.
You may want to hide all of your sheets except the one showing the message.
If macros is not enabled then your workbook will be more protected.

Tom
 
Upvote 0

Forum statistics

Threads
1,213,522
Messages
6,114,112
Members
448,549
Latest member
brianhfield

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