K
ker_01
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
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