PDA

View Full Version : [SOLVED:] Show Excel Worksheet from xlMinimized



simora
06-16-2017, 05:21 PM
I have 2 Excel User Forms.

If I call the 2nd Form from the first like this


Unload Me
UserForm1.Show
Application.WindowState = xlMinimized


And then try to show Excel from this UserForm1 Like this


If Application.WindowState = xlMinimized Then
Application.WindowState = xlMaximized

OR
ActiveWindow.WindowState = xlNormal
Application.Visible = True


No matter what I've tried, this form will NOT open the Excel document as Normal , or anything else.
Any ideas as to why this does NOT work ?

Using Office 2007

Logit
06-16-2017, 07:22 PM
How about in User Form 2 using this macro instead:


Private Sub UserForm_Initialize()
Application.WindowState = xlNormal
End Sub




I have to ask, why minimize the application window between Forms ? What is the purpose of doing so ?

Bob Phillips
06-17-2017, 12:05 AM
The code you show us seems a bit skewy. You say call the 2nd form, but the code refers to Userform1, and setting the window to minimized comes after the userform show, so won't happen whilst the form is up.

simora
06-17-2017, 12:46 AM
I finally figured it out.
If I call Userform1 from the other form like this;


Unload Me
UserForm1.Show
Application.WindowState = xlMinimized

The WindowState is already Minimized, so I deleted the Application.WindowState = xlMinimized;

It now works.
I didn't have this problem when I last used this years ago on Excel 2003

Thanks for all your input.