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.
 

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
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
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,197
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.
 

Forum statistics

Threads
1,077,831
Messages
5,336,656
Members
399,094
Latest member
Learner2019

Some videos you may like

This Week's Hot Topics

Top