enable macros automatically

hmk

Active Member
Joined
Jun 8, 2004
Messages
423
Hi all

Is there a vba code to enable the macros when opening an xls file?

i.e make the enable works automatically in opening files

yours
h
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
To have a macro execute automatically, put it in the Workbook's Open method.

No, you cannot programmitically defeat safety measures (think about it...:wink:)
 
Upvote 0
There are ways to "force" users to enable macros or your workbook will be disabled. A board search for "Force Macros" will turn up several viable discussions.

Hope that helps,

Smitty
 
Upvote 0
hi,

you can do this by right clicking on the Sheet1 tab and click on View Code.

here put the following code:

Private Sub Workbook_Open()
Call YourStartupCode
End Sub

this will run the code you want to start when you open the excel file. Replace YourStartupCode with the procedure name you want to start with.
 
Upvote 0
To add to what Smitty recommended, you might add the term xlveryhidden to your search criteria. "Forcing" macros to be enabled almost always entails the use of that property.
 
Upvote 0

Forum statistics

Threads
1,215,903
Messages
6,127,652
Members
449,395
Latest member
Perdi

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