Enable Macro when open workbook

Rungravee Boonsud

New Member
Joined
Feb 19, 2019
Messages
11
Hi Everyone,

Can I force user for enable macro when open workbook.

because if user disable macros...the macro cannot run :(

I want to always run macro with this workbook

Anyone have advise this case ?
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
As it's a safety measure, there is no straight solution for this. Imagine a malicious code enabling macro's by itself, thereby easily surpassing this defense strategy.

A workaround is to show the user they have to enable macros by showing them a splash screen, as is explained more in detail here.

If you are opening a workbook which itself contains macros with VBA, then you can indeed enable macros via VBA. Take a look at this link, and this other link.
 
Last edited:
Upvote 0
The trust centre (File - Options - Trust Centre) allows macros to be enabled automatically when a spreadsheet is opened.To get a macro to auto-run call it Auto_open
 
Upvote 0
Steve,

This requires a user action which may very well be not preferred. Moreover, this option would enable macros on every succeeding workbook the user will open, if the settings are not reversed beforehand. This is a potential security concern.
 
Upvote 0
Apologies for the delay. I had to reply from home as the board is often blocked at work.

Yes it can be a risk, but only if you import macros. Mine are all my own work (you can tell that because the coding techniques are so out of date).
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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