Auto-Enable Excel Auto_open Macro

FrankFischer

New Member
Joined
Nov 27, 2002
Messages
9
I have written an MS Access function that uses the Shell command to launch a file in MS Excel.

The Excel file has an Auto_Open Macro. My problem is the annoying virus warning. I do not want to permanently disable macro virus protection. Is there a way to have Excel automatically recognize specific spreadsheets to contain legitimate macros?
This message was edited by FrankFischer on 2002-11-28 19:18
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hi,

It can be done, but I don't think anyone around here who knows how to disable the 'enable macros' prompt will tell you how. I certainly don't know how. If you think about, there's two problems with attempting to bypass the 'enable macros' prompt. First, you can't have a macro execute when you haven't enabled macros yet, and second, allowing this message to be bypassed would totally defeat the purpose of it being there in the first place, which is to prevent your Excel from running macros you don't know about. It would make writing viruses a breeze.
There are two workarounds. The easy one is to lower your security settings, but I don't like this method, as it leaves you unprotected from viruses. The second is to use digital signatures.

To create and use a digital signature:

Run the Office 2000 setup program.

On the Select Features screen in the setup program, expand Office Tools.

Select Digital Signature for VBA projects, click the arrow next to your selection, and then select Run from My Computer.

In Windows Explorer, locate and then double-click the file SelfCert.exe in C:Program FilesMicrosoft OfficeOffice.

Note, Because a digital certificate that you create yourself isn’t issued by a formal certification authority, macro projects that are signed by using such a certificate are referred to as self-signed projects. Depending on how your organization uses the digital-signature features in Microsoft Office, you might be prevented from using such a certificate, and other users might not be able to run self-signed macros for security reasons.

Once you've digitaly signed your work, the first time you open the file on a users computer, it will ask if the digital certificate is to be trusted. You can tell XL to always trust code signed by this person.

From then on, the user's computer, regardless of security setting, files will open without disable macros prompt.
If there's any reason that this doesn't work, let me know, but from experience around the office and with applications I've sent around the state, its always worked.

HTH,

_________________<EMBED width="118" height="52" src="http://corticus.biz.ly/CorticusLink.swf"></EMBED>
This message was edited by Corticus on 2002-11-28 22:46
 
Upvote 0
Hi Frank,

If you try using Microsoft Excel Object Library in Access VBA (Tools_References : Microsoft Excel Object Library x.0) instead Sheel and also replacing Auto_Open macro codes into Thisdocument: Workbook_Open sub then you can use the sample code below to open excel workbook which has macro and then it will not ask Enabling macros because it uses the Enabled Macro already.

Sub OpenMacroEnabled()
Dim xls As Excel.Application
Dim wrk As Workbook
Set xls = New Excel.Application
Set wrk = xls.Workbooks.Open("c:windowsdesktopbook1.xls")
xls.Visible = True
Set wrk = Nothing
Set xls = Nothing
End Sub

Hope this helps.
Suat
 
Upvote 0

Forum statistics

Threads
1,221,490
Messages
6,160,133
Members
451,622
Latest member
xmrwnx89

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