How to force Excel to turn on macro when open?

hon

Board Regular
Joined
Oct 10, 2005
Messages
73
Just want to find out if it is possible to force Excel to turn on macro when open.
 

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.

Tazguy37

MrExcel MVP
Joined
May 28, 2004
Messages
4,237
Here's one way. Actually, it's several ways, but you get the idea. I like the EnableMacros.zip method, myself.

Hope that helps!
 

hon

Board Regular
Joined
Oct 10, 2005
Messages
73
not quite what I wanted. The reason why I want this feature is I want to stop users from making coping of the master file stored in our internet portal. I have a before_save macro to disable some function rendering it useless. But this macro won't work if a user can turn off the macro and save a copy in their own drive.
 

Nimrod

MrExcel MVP
Joined
Apr 29, 2002
Messages
6,259
hon

This is no way to prevent a user from disabling macros, or a macro enabling macros. If this was possible then virus's could easily infect your system :wink:
 

hon

Board Regular
Joined
Oct 10, 2005
Messages
73

ADVERTISEMENT

but is it possible to tell Excel not to load macro/VBA if macro is turned off so that if a user do try to save the file, it would be useless without the macro.
 

Tazguy37

MrExcel MVP
Joined
May 28, 2004
Messages
4,237
You could disable Save and Save As for that file through VBA code. Perhaps include a macro (tied to a button) that uses an input box to ask for a password before you can save.
 

hon

Board Regular
Joined
Oct 10, 2005
Messages
73

ADVERTISEMENT

This won't work if the user turns off the macro on open
 

hon

Board Regular
Joined
Oct 10, 2005
Messages
73
Hi Tom, your solution from last night also depends on macro being turned on on open, right?
 

Tom Urtis

MrExcel MVP
Joined
Feb 10, 2002
Messages
11,270
If "turned on" to you means Enabled, then yes it does, which I said twice last night is not possible to control, and others have told you the same thing last night and now again here tonight:
Tom Urtis said:
Security (such as it is) is handled at the local (computer) level, and if someone wants to make a copy of the workbook they will, in Explorer or other ways that are easily available totally outside of the workbook author's control.
Tom Urtis said:
there are no guarantees against piracy, intranet or not, and especially not possible to control the macro security settings of one computer from another.
Nimrod said:
hon

This is no way to prevent a user from disabling macros, or a macro enabling macros. If this was possible then virus's could easily infect your system :wink:

Thne I gave you directions and code to take the macros out of a file and make a copy of that file so it has no code in it. That way you won't have to worry about th euser's security settings because the file you are sending them has no code, which you originally asked about.

Beyond that, maybe you need a platform other than Excel.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,995
Messages
5,834,779
Members
430,321
Latest member
yemisimi11

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
Top