![]() |
How to create a bug report?
Barb-
Thank you for your reply. I tried your suggestion, but it did not disable the macros in the xlsm workbooks that were being opened. My real code cycles through multiple files to retrieve data. Prior to this thread, I did add a debug.print line in between every actual code line in my real file. Each debug line was triggered (including after every security line) until it got to the first xlsm file that actually had macros; then each debug line was still triggered up to the .open line, which successfully opens the xlsm file (as does the demonstration code in the original post for this thread). The problem is that it never returns control to the source macro in the 2003 workbook, so there is no execution of any code after the .open line. Thank you, Keith "Barb Reinhardt" wrote: If you step through your code, I bet it stops at this line Application.AutomationSecurity = msoAutomationSecurityForceDisable Change it to this Application.AutomationSecurity = msoAutomationSecurityLow HTH, Barb Reinhardt "ker_01" wrote: I have a replicable problem trying to open XL2007 xlsm files from XL2003, with the requirement that the macros in the 2007 file must be disabled (the workbooks are being opened to pull data, but each workbook's "_open" includes code that resets the target data based on the userID of the person opening the file). I have recreated a test case with 12 lines of code (3 in one workbook, 9 in another-see below. I did some searching, but couldn't find any obvious way to submit this to MS. Does anyone have a link or information on how to submit bugs? To replicate the problem: ----------------------------- Create a blank 2007 workbook. In the workbook_open event, add msgbox "hello world" (3 lines of code total). Save the file as XL2007 macro enabled file type (XLSM). Open a blank 2003 workbook. Add the following code: Sub test2007macrowkbk() Dim secAutomation As MsoAutomationSecurity secAutomation = Application.AutomationSecurity Application.AutomationSecurity = msoAutomationSecurityForceDisable Application.Workbooks.Open Filename:="K:\test2007macro.xlsm", UpdateLinks:=False, ReadOnly:=True Msgbox "Process Complete" Application.AutomationSecurity = secAutomation End Sub (replace the filename with the filename of the XL2007 file you saved) Run the 2003 code. It never makes it to the "process complete" message, the code just dies after opening the 2007 workbook. If you remove the security lines of code, it will open the 2007 workbook and trigger the "hello world" message. If you save the 2003 workbook, open it in 2007 and run the code from 2007, it opens the original 2007 workbook as expected (with macros disabled), then shows the "process complete" message. If there is an alternative way to open a 2007 XLSM file from 2003 with macros disabled, please let me know. If there isn't another way, then I'm still thinking this would be appropriate for a bug report, and I welcome any information on how to submit one. Thank you! Keith |
How to create a bug report?
Ok, then you need to add this
Application.EnableEvents = False 'Before you open the workbooks and Application.EnableEvents = True 'After you open the workbooks. The response I provide previously would only disable the message about enabling macros when you open the workbook. HTH, Barb Reinhardt "ker_01" wrote: Barb- Thank you for your reply. I tried your suggestion, but it did not disable the macros in the xlsm workbooks that were being opened. My real code cycles through multiple files to retrieve data. Prior to this thread, I did add a debug.print line in between every actual code line in my real file. Each debug line was triggered (including after every security line) until it got to the first xlsm file that actually had macros; then each debug line was still triggered up to the .open line, which successfully opens the xlsm file (as does the demonstration code in the original post for this thread). The problem is that it never returns control to the source macro in the 2003 workbook, so there is no execution of any code after the .open line. Thank you, Keith "Barb Reinhardt" wrote: If you step through your code, I bet it stops at this line Application.AutomationSecurity = msoAutomationSecurityForceDisable Change it to this Application.AutomationSecurity = msoAutomationSecurityLow HTH, Barb Reinhardt "ker_01" wrote: I have a replicable problem trying to open XL2007 xlsm files from XL2003, with the requirement that the macros in the 2007 file must be disabled (the workbooks are being opened to pull data, but each workbook's "_open" includes code that resets the target data based on the userID of the person opening the file). I have recreated a test case with 12 lines of code (3 in one workbook, 9 in another-see below. I did some searching, but couldn't find any obvious way to submit this to MS. Does anyone have a link or information on how to submit bugs? To replicate the problem: ----------------------------- Create a blank 2007 workbook. In the workbook_open event, add msgbox "hello world" (3 lines of code total). Save the file as XL2007 macro enabled file type (XLSM). Open a blank 2003 workbook. Add the following code: Sub test2007macrowkbk() Dim secAutomation As MsoAutomationSecurity secAutomation = Application.AutomationSecurity Application.AutomationSecurity = msoAutomationSecurityForceDisable Application.Workbooks.Open Filename:="K:\test2007macro.xlsm", UpdateLinks:=False, ReadOnly:=True Msgbox "Process Complete" Application.AutomationSecurity = secAutomation End Sub (replace the filename with the filename of the XL2007 file you saved) Run the 2003 code. It never makes it to the "process complete" message, the code just dies after opening the 2007 workbook. If you remove the security lines of code, it will open the 2007 workbook and trigger the "hello world" message. If you save the 2003 workbook, open it in 2007 and run the code from 2007, it opens the original 2007 workbook as expected (with macros disabled), then shows the "process complete" message. If there is an alternative way to open a 2007 XLSM file from 2003 with macros disabled, please let me know. If there isn't another way, then I'm still thinking this would be appropriate for a bug report, and I welcome any information on how to submit one. Thank you! Keith |
How to create a bug report?
Unfortunately, even with application.EnableEvents in place, it still fails
when opening the first xlsm file that contains macros. Using Application.EnableEvents, I tried it both with the lines of security I had in place, then tried again after commenting them out in case they interfere with ..EnableEvents. No joy either way. Sub test2007macrowkbk() Dim secAutomation As MsoAutomationSecurity secAutomation = Application.AutomationSecurity Application.AutomationSecurity = msoAutomationSecurityForceDisable Application.EnableEvents = False Application.Workbooks.Open Filename:="K:\test2007macro.xlsm", UpdateLinks:=False, ReadOnly:=True Application.EnableEvents = True Msgbox "Process Complete" Application.AutomationSecurity = secAutomation End Sub Thank you for your continued advice, Keith "Barb Reinhardt" wrote: Ok, then you need to add this Application.EnableEvents = False 'Before you open the workbooks and Application.EnableEvents = True 'After you open the workbooks. The response I provide previously would only disable the message about enabling macros when you open the workbook. HTH, Barb Reinhardt "ker_01" wrote: Barb- Thank you for your reply. I tried your suggestion, but it did not disable the macros in the xlsm workbooks that were being opened. My real code cycles through multiple files to retrieve data. Prior to this thread, I did add a debug.print line in between every actual code line in my real file. Each debug line was triggered (including after every security line) until it got to the first xlsm file that actually had macros; then each debug line was still triggered up to the .open line, which successfully opens the xlsm file (as does the demonstration code in the original post for this thread). The problem is that it never returns control to the source macro in the 2003 workbook, so there is no execution of any code after the .open line. Thank you, Keith "Barb Reinhardt" wrote: If you step through your code, I bet it stops at this line Application.AutomationSecurity = msoAutomationSecurityForceDisable Change it to this Application.AutomationSecurity = msoAutomationSecurityLow HTH, Barb Reinhardt "ker_01" wrote: I have a replicable problem trying to open XL2007 xlsm files from XL2003, with the requirement that the macros in the 2007 file must be disabled (the workbooks are being opened to pull data, but each workbook's "_open" includes code that resets the target data based on the userID of the person opening the file). I have recreated a test case with 12 lines of code (3 in one workbook, 9 in another-see below. I did some searching, but couldn't find any obvious way to submit this to MS. Does anyone have a link or information on how to submit bugs? To replicate the problem: ----------------------------- Create a blank 2007 workbook. In the workbook_open event, add msgbox "hello world" (3 lines of code total). Save the file as XL2007 macro enabled file type (XLSM). Open a blank 2003 workbook. Add the following code: Sub test2007macrowkbk() Dim secAutomation As MsoAutomationSecurity secAutomation = Application.AutomationSecurity Application.AutomationSecurity = msoAutomationSecurityForceDisable Application.Workbooks.Open Filename:="K:\test2007macro.xlsm", UpdateLinks:=False, ReadOnly:=True Msgbox "Process Complete" Application.AutomationSecurity = secAutomation End Sub (replace the filename with the filename of the XL2007 file you saved) Run the 2003 code. It never makes it to the "process complete" message, the code just dies after opening the 2007 workbook. If you remove the security lines of code, it will open the 2007 workbook and trigger the "hello world" message. If you save the 2003 workbook, open it in 2007 and run the code from 2007, it opens the original 2007 workbook as expected (with macros disabled), then shows the "process complete" message. If there is an alternative way to open a 2007 XLSM file from 2003 with macros disabled, please let me know. If there isn't another way, then I'm still thinking this would be appropriate for a bug report, and I welcome any information on how to submit one. Thank you! Keith |
All times are GMT +1. The time now is 12:42 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com