With Excel 2003, you could add the 'Autpen' macro. When Excel opens a spreadsheet that has macros, it looks for one called 'Autpen'. If it finds this macro, it automatically runs. This macro is stored with the spreadsheet, so each spreadsheet can have its own 'Autpen' macro. To avoid the 'enable macros' prompt when the spreadsheet is opened, you would need to set the macro security to 'low'.
you can create a vbscript file which opens your Excel file.
If you put your macro code into the workbook_open it will rin in the same manner which pgmer mentioned.
I DO NOT recommend setting macro security to low. Doing this mean you could open a file with a macro which will harm your computer without you even knowing it was doing so.
Create your xls file with the workbook_open code doing wat you want it to then launch it by typing the following code into notepad then saving it as filename.VBS (this makes the file a vb script which windows will run if it's double clicked)
Code:
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open _
("C:\Test\book1.xls")
objExcel.Quit
change the path to point to your excel file.
Lauching your excel file in this way will not ask you to enable macros, but still lets you keep macro security set to medium
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.