Start macro with excel minimised

John Yazou

New Member
Joined
Mar 17, 2002
Messages
49
Hi all,
I have UserForm1 in my workbook. Is there a way such that whenever the workbook is opened, UserForm1 is displayed, and Excel minimised. Also, any similar techniques for MS-Word??
Thanks a bunch..
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Hi,
Go to VBA Editor, add these codes to ThisWorkbook/ThisDocument object.

For Excel:

Private Sub Workbook_Open()
Application.WindowState = wdWindowStateMinimize
Load UserForm1
UserForm1.Show

End Sub


For MS-Word:

Private Sub Document_Open()
Application.WindowState = wdWindowStateMinimize
Load UserForm1
UserForm1.Show
End Sub
 
Upvote 0
Try this

Copy it into the "this workbook module"

It is an auto open macro that runs anytime the workbook is opened. To bypass it - hold down the shift when you open the workbook

Private Sub Workbook_Open()
ActiveWindow.WindowState = xlMinimized
Application.ScreenUpdating = False
Call "procedure that loads your form"
Application.ScreenUpdating = True
End Sub


Good luck
 
Upvote 0
Hi John,

In your Workbook_Open routine, include the following:

ActiveWindow.WindowState = xlMinimized
UserForm1.Show
ActiveWindow.WindowState = xlMaximized

When you dismiss the userform, the window state is is maximized (use xlNormal to return to the visible, non-max state).

Note that you cannot use

Application.WindowState = xlMinimized

to hide Excel from view and then work with the userform, you can only minimize the active windows.

HTH,
Jay
 
Upvote 0
Or, yet another way which I use to hide Excel when opening a workbook with a custom password dialog:

Application.Visible = False
'do your thingy
Application.Visible = True

this hides Excel completely, then shows it when invoking "True."

Aloha!
 
Upvote 0
On 2002-03-20 17:02, Jay Petrulis wrote:
Hi John,

In your Workbook_Open routine, include the following:

ActiveWindow.WindowState = xlMinimized
UserForm1.Show
ActiveWindow.WindowState = xlMaximized

When you dismiss the userform, the window state is is maximized (use xlNormal to return to the visible, non-max state).

Note that you cannot use

Application.WindowState = xlMinimized

to hide Excel from view and then work with the userform, you can only minimize the active windows.

HTH,
Jay

What do mean Jay? Yes you can!
 
Upvote 0

Forum statistics

Threads
1,214,584
Messages
6,120,384
Members
448,956
Latest member
JPav

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