You can't. Enabling macros is a security feature to prevent viruses. It would
not be too useful if a virus could just enable macros.
What you can do it look at digital signatures or setting up a system to make
the spreadsheet indicate that Macros are not enabled. Basically have a sheet
that gets hidden by a macro. If macros are not disabled then the sheet does
not get hidden and the end user is notified of the need to enable macros...
You could run a VBScript before opening the Excel file to set the macro
security to medium or even low. Here is a script that will change the macro
security level to low for Excel XP. The path may change a bit for different
versions of Excel.
Option Explicit
Dim objShell, RegLocate
Set objShell = WScript.CreateObject("WScript.Shell")
On Error Resume Next
RegLocate =
"HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Excel\Security\Level"
objShell.RegWrite RegLocate,"1","REG_DWORD"
WScript.Quit
You can't force macros to be enabled. That would invalidate the entire
purpose of disabling them. One option is to make your workbook unusable if
macros are disabled. See http://www.cpearson.com/excel/EnableMacros.aspx .
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting www.cpearson.com
(email on the web site)
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.