MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Are you a VBA expert... Macro Protection Box


Posted by Jack on October 15, 2001 10:49 AM

I roam my office im need a VBA code that will jump macros warni and open my work SS regardless if protection switched ON or OFF, any ideas, would make my life a lot easier

Many thanks in advance...


Posted by Damon Ostrander on October 15, 2001 7:24 PM

Hi Jack,

I am not aware of a way to bypass the macro protection, other than setting your Excel macro security settings to LOW (Tools -> Macro -> Security...). Of course, this will work only for you since you cannot change the security settings for others. If you could defeat the warning, this would mean you had defeated the macro virus protection of Excel, and suggest that even the protections Microsoft has put in place are not sufficient to protect you from viruses. I think that if such a "trap door" were discovered, Microsoft would work hard to close it in a Service Pack release and in later versions of Excel.

I occasionally encounter the situation that I create a workbook that will not work correctly if the user does not enable macros. I have found a simple way to force the user to enable macros on opening the workbook: simply hide all the worksheets (xlVeryHidden so they don't show up in the Unhide menu) except for one blank sheet that has the message: "you must enable macros in order to view the contents of this workbook." Then add code to the workbook's Open event that unhides all the worksheets, and hides the one with the message. Only when the workbook is opened with macros enabled will the worksheets be visible and usable. Of course, code is also needed to re-hide the worksheets when the workbook is closed or saved, and the code (VBProject) itself must be protected.

I hope this helps.

Damon

Posted by Jack on October 16, 2001 1:58 AM

damon macro protection

True, i guess i was looking for a trap door, would be nice i see your point if you or i can then hackrs and virus writters will cause us damage, shame always those who spoil for the rest.

I know there are Virus which attack Excel files i guess they have dodged this, but i feel maybe not such a ggod idea, i would if i could as i maintain the files