Unload Form Maximizes Excel Application Window

richExcelforAJ

New Member
Joined
Jul 12, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I have two forms in my workbook.

Whenever I unload either of them, the Excel application maximizes. So, I set the Application window state and the active window state to xlNormal:

Application.WindowState = xlNormal
ActiveWindow.WindowState = xlNormal

I tried both methods immediately before and immediately after the 'unload form' statement. When I unload either form, the Excel Application instantly maximizes and then returns to normal. The above commands both work but not in time to prevent a very disconcerting flash to maximized and back.

Both the red X and the form close button execute the same code and behave the same.

The sequence is just
Load form
form.show
Unload form

This is the form Exit code:
Application.ScreenUpdating = False
Application.DisplayAlerts = False

Unload frmCustomerData
Application.WindowState = xlNormal
'Unload frmTransparent

Worksheets("Dashboard").Select
Worksheets("Dashboard").Visible = True

Application.ScreenUpdating = True
Application.DisplayAlerts = True

Has anyone seen this before or have suggestions on preventing it?
Below are the form properties for one of the forms.

Picture1.png
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
I cannot replicate that behavior. Some comments.

What happens if you skip the LOAD statement and just do .SHOW?

What happens if you move your UNLOAD statement into the form code, i.e.
VBA Code:
Private Sub cmdClose_Click()
   Unload Me
End Sub

What happens if you hide the form first, before you unload it?
VBA Code:
Private Sub cmdClose_Click()
    Me.Hide
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,583
Messages
6,125,661
Members
449,247
Latest member
wingedshoes

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