If macros are not enabled - close excel?

MRK_Toledo

New Member
Joined
Sep 2, 2006
Messages
34
Is it possible to close excel, or exit the program if Macros are not enabled?

If that can be done - is it also possible to display a message box that
would explain to the user what is happening, then they would have to
confirm by clicking OK, then the program would quit?

I would like to see what some code would look like to do this, if this is possible.

Thanks.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Hi there

This is an interesting one. If macros are not enabled how exactly will it run code to open a message box or close the file?

If you use the search on this site you will find some workarounds to this. They involve hiding all sheets except a splash page. The splash page provides a macro button which unhides the other sheets (Obviously this forces the user to enable macros if they want to continue). A workbook Close Event macro hides the sheets again when the file is closed.
The sheets need to be very hidden to prevent the user unhiding them from the toolbar Format / Sheets / Unhide and the code in the VB Editor needs to be locked.

regards
Derek
 
Upvote 0
Thanks for the reply.......the solution that you are suggesting I have already tried. I don't like it too much due to the fact that I have to see my splash page, or the Macros Disabled page avery time I open and close the workbook. I am looking for a cleaner, smoother solution.

I'm not sure if I'll find it, but I'm lookin!

Thanks again for the suggestion.
 
Upvote 0
Hi again

If you find a way around that then it will open up all sorts of possibilities for malicious code writers. Obviously the enable/disable macros pop-up is protection against the possibility of harmful code and therefore a decision input from the user is unavoidable. If it were possible to close the file instantly when macros are disabled, this might also cause a problem if you later wished to later modify a workbook without causing Open-Event macros to run.

regards
Derek
 
Upvote 0
What about using digital signatures?

You could have a macro that auto hides all sheets unless they run macros. Then you won't see anything, just an empty Excel.

However, if they have your certificate as trusted, the macro would run and unhide whatever sheets you want to display.
 
Upvote 0

Forum statistics

Threads
1,218,560
Messages
6,143,204
Members
450,469
Latest member
brent3162

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