Excel workbook automatically restores after opening

Mrock1

Board Regular
Joined
Oct 7, 2014
Messages
78
I have a workbook that, among other things, minimizes on opening using the VBA command, Application.WindowState = xlMinimizes, in the Workbook_Open macro.

This worked for years until recently when it began to restore the workbook window to its last size. The restore happens the moment the Workbook_Open subroutine completes. I've verified this by placing an Msgbox command at the very last command in Workbook_Open.

Thinking I may have inadvertently caused this problem via a change one of my macros (it has quite a few) I set a breakpoint, reopened the workbook and single-stepped through the code (F8). The second it hit the End Sub the workbook restored from its previous minimised state.

I also created a new macro enabled workbook with only 2 commands in the Workbook_Open macro in the Thisworkbook module:
Application.windowstate = xlMinimized
Msgbox "Pause"

On loading, this test workbook minimizes as expected, presents the message box. But as soon as I respond to the message box, the workbook automatically restores on the display.

Most interestingly, if I subsequently manually execute the Workbook_Open macro in VBE(run or step), it behaves properly and stays minimized.

I simply cannot figure out what is happening. Perhaps there is some setting in the Excel Options, but I just don't know.

Appreciate any help.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,633
Latest member
DougMo

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