![]() |
Disable "On Open" macro
Our cost centers have a workbook (ProcessData) with a number of macros in it.
The code for one of the macros is contained in a "Workbook Open" sub. This code does a number of things depending on what it finds when the workbook (ProcessData) is opened each time. A msgbox may be displayed for the user. If a msgbox is displayed, a second macro kicks off when the user presses "OK". When the user is finished updating their data, there is another macro in this same workbook (ProcessData) that is used to (1) make a copy of their workbook (ProcessData) and (2) place a copy on a shared network drive. I have a macro to open each copy and extract the data. The problem I'm having is the "Workbook Open" sub runs each time one of the copies is opened. If the msgbox is displayed, the my macro stops until I click "OK". The msgbox is only important to the cost centers and is not needed for the macro I am running. My question is: is it possible to disable the macros contained in the submitted copies so the msgbox is never displayed. I only need to extract the data on these copies, I do not want to let the second macro kick off. Below is the line of code, I'm using to open the submitted files: Workbooks.Open (MyPath & MyFile) Thanks for the help........ ---- JT |
Disable "On Open" macro
Open the secondary workbooks in Office Safe Mode. For example:
Sub is_it_safe() Dim s As String Dim s2 As String s2 = "C:\temp\child1.xls /s" s = "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.exe " x = Shell(s & s2, 1) End Sub -- Gary''s Student - gsnu200800 "JT" wrote: Our cost centers have a workbook (ProcessData) with a number of macros in it. The code for one of the macros is contained in a "Workbook Open" sub. This code does a number of things depending on what it finds when the workbook (ProcessData) is opened each time. A msgbox may be displayed for the user. If a msgbox is displayed, a second macro kicks off when the user presses "OK". When the user is finished updating their data, there is another macro in this same workbook (ProcessData) that is used to (1) make a copy of their workbook (ProcessData) and (2) place a copy on a shared network drive. I have a macro to open each copy and extract the data. The problem I'm having is the "Workbook Open" sub runs each time one of the copies is opened. If the msgbox is displayed, the my macro stops until I click "OK". The msgbox is only important to the cost centers and is not needed for the macro I am running. My question is: is it possible to disable the macros contained in the submitted copies so the msgbox is never displayed. I only need to extract the data on these copies, I do not want to let the second macro kick off. Below is the line of code, I'm using to open the submitted files: Workbooks.Open (MyPath & MyFile) Thanks for the help........ ---- JT |
All times are GMT +1. The time now is 05:25 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com