![]() |
Opening a file and enabling macros automatically
Guys, When you open an excel file which has VB code in it, you are asked (depening on your macro security settings) if you would like to disable or enable macros. Is there a way (perhaps via the auto_open code to stop this message popping up and automatically enabling these macros? Look forward to hearing your thoughts. Regards, Fernando -- Fernandoalberte ------------------------------------------------------------------------ Fernandoalberte's Profile: http://www.excelforum.com/member.php...o&userid=24493 View this thread: http://www.excelforum.com/showthread...hreadid=383030 |
If macros are disabled, then auto_open won't run.
This is a security measure. If you could bypass this level of security, then it wouldn't be very useful. One way around it is to use a dummy workbook that contains one worksheet and a macro that opens the real workbook (and closes the dummy workbook). Have the user open that. If macros are disabled, the macro won't run and the user can see your warning on that single sheet: "Please open with macros enabled!" If the user opens with macros enabled, then the real file opens with its macros enabled. The macro could look like this: Option Explicit Sub auto_open() Workbooks.Open Filename:="c:\my documents\excel\book2.xls" ThisWorkbook.Close savechanges:=False End Sub Fernandoalberte wrote: Guys, When you open an excel file which has VB code in it, you are asked (depening on your macro security settings) if you would like to disable or enable macros. Is there a way (perhaps via the auto_open code to stop this message popping up and automatically enabling these macros? Look forward to hearing your thoughts. Regards, Fernando -- Fernandoalberte ------------------------------------------------------------------------ Fernandoalberte's Profile: http://www.excelforum.com/member.php...o&userid=24493 View this thread: http://www.excelforum.com/showthread...hreadid=383030 -- Dave Peterson |
All times are GMT +1. The time now is 02:27 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com