Macros in other workbook fail when I open I newly stored workbook

Mrock1

Board Regular
Joined
Oct 7, 2014
Messages
77
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
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
As an update and this is quite empirical, I think the situation is that any macro (or at least certain functions) seem to fail in any Excel instance when a workbook is opened in Protected View for any reason, until that Protected View message is closed or acknowledged.

As I said in my original post, it seems crazy that opening a new workbook in Protected View, in a new and presumable independent instance of Excel, should be able to impact a macro in any other workbook opened in another Excel instance. But the observation is that until the Protected View warning message is closed or otherwise acknowledged, it seems that some functions in some macros, in other workbook/instances, will report and error.

Just weird.

Max
 
Upvote 0

Forum statistics

Threads
1,213,510
Messages
6,114,037
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top