I have one workbook that has a Workbook_Resize event macro in its ThisWorkbook module. The workbook has an AutoOpen macro that among other things sets a public/global variable - Filename - to the value of ThisWorkbook(). E.g. File.xlsm.
As a matter of procedure and knowing that my macros sometimes crash if interacting with other workbook macros, so I always open subsequent workbooks in new instances of Excel (hold down the Alt key when opening). However, even if I do this, my first instance of Excel seems to always want to trigger its Workbook_WindowResize() function. If the second workbook is newly copied, I get the Enable Editing message in a yellow bar across the top of that workbook and the bar at the top o the workbook as it opens, the Workbooks(Filename).Sheets("SheetName").Activate within the Workboook_WindowResize subroutine always errors until I Enable Editing on the second workbook, which I find perplexing and annoying.
1. The original workbook is running in its own instance and Workbook function in the ThisWorkbook module should not trigger when something happens in another Excel instance.
2. So, not only is the Workbook_WindowResize macro stored in a ThisWorkbook module of an individual workbook and it should be completely independent of any other workbook, the second workbook is also running in a completely separate instance of Excel.
3. The only time this situation occurs is when I've recently saved the second workbook (e.g. from email attachment) AND it opens in Protected View and prompts me to Enable Editing in the yellow message bar across the time is present. As soon as I acknowledge or close the message bar, the macro will proceed normally.
I can accept that my first workbook (usually minimised) *may* actually be restoring/resizing for some weird reason when I open the second workbook in the second Excel instance, but even then I can't understand why the function I mention errors while that message bar is atop the second workbook.
I would appreciate any help. I don't think this should be happening, but it's got something to do with that yellow message bar. While it's difficult to reproduce without saving a new copy of the workbook from the original source, I can bring it about if I have another macro enabled workbook that I haven't trusted, so it produces the Enable Content message bar.
Thanks
Max
As a matter of procedure and knowing that my macros sometimes crash if interacting with other workbook macros, so I always open subsequent workbooks in new instances of Excel (hold down the Alt key when opening). However, even if I do this, my first instance of Excel seems to always want to trigger its Workbook_WindowResize() function. If the second workbook is newly copied, I get the Enable Editing message in a yellow bar across the top of that workbook and the bar at the top o the workbook as it opens, the Workbooks(Filename).Sheets("SheetName").Activate within the Workboook_WindowResize subroutine always errors until I Enable Editing on the second workbook, which I find perplexing and annoying.
1. The original workbook is running in its own instance and Workbook function in the ThisWorkbook module should not trigger when something happens in another Excel instance.
2. So, not only is the Workbook_WindowResize macro stored in a ThisWorkbook module of an individual workbook and it should be completely independent of any other workbook, the second workbook is also running in a completely separate instance of Excel.
3. The only time this situation occurs is when I've recently saved the second workbook (e.g. from email attachment) AND it opens in Protected View and prompts me to Enable Editing in the yellow message bar across the time is present. As soon as I acknowledge or close the message bar, the macro will proceed normally.
I can accept that my first workbook (usually minimised) *may* actually be restoring/resizing for some weird reason when I open the second workbook in the second Excel instance, but even then I can't understand why the function I mention errors while that message bar is atop the second workbook.
I would appreciate any help. I don't think this should be happening, but it's got something to do with that yellow message bar. While it's difficult to reproduce without saving a new copy of the workbook from the original source, I can bring it about if I have another macro enabled workbook that I haven't trusted, so it produces the Enable Content message bar.
Thanks
Max