Excel 2003 VBA - How can I dynamically disable all macros?

JoeDBugger

New Member
Joined
Apr 22, 2009
Messages
9
Using Excel 2003 VBA, how can I programmatically disable all macros? Or, can it be done? All of my internet searching for an answer thus far strongly suggests it can't be done.

This is to be done for anyone other than myself who opens the workbook. I already know how to accomplish this by entering my account name in a password protected sheet's cell, and turning the font to white. I also have to ensure that I don't protect that sheet with the cursor in that special cell. Otherwise, the value in the cell can be read from the fx entry field.

Thanks.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
It maybe not the most elegant solution but by adding an if statement to start of each macro you can test if it's you.

The below uses two Environment variables, User name and Computer name.
Code:
Sub macro1()
    If Environ("username") & Environ("computername") <> "RobWorkstation13" Then Exit Sub
'// Code

You could also test if a sheet that only you can unprotect has been unprotected
Code:
If Sheets("Sheet1").ProtectContents Then Exit Sub

Might be something that can be applied globally but that beyond me at the present time.
 
Upvote 0
Thank you, for your two suggestions.

Since submitting my question, I had thought about the User Name piece of your first suggestion. I should have worded my question differently to illicit the preferred solution. That is, how can I dynamically disable all Macros in the same way as when a Workbook is opened? Obviously, this capability is not available in Excel 2003 VBA.

Thank you again, for your time and suggestions.
 
Upvote 0

Forum statistics

Threads
1,224,552
Messages
6,179,487
Members
452,917
Latest member
MrsMSalt

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