UserForm and Workbook_Open()

Mr. Wizard

Board Regular
Joined
Sep 28, 2005
Messages
67
I have created a user form that does everything I've told it to except pop up when the spreadsheet opens. The Workbook_Open seems to ignore the call to show the user form, and I am at a loss as to why.

What I would like to do is make all worksheets invisible, and only pop up the user interface (a user form). If I could make it so that it does not appear as an Excel spreadsheet, this would be good.

Can I get some suggestions?
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Code:
Private Sub Workbook_Open()

Application.Visible = False

    Load UserForm1
    UserForm1.Show

Application.Visible = True

End Sub
 
Upvote 0
Where have you placed the code for the Open event?
 
Upvote 0
I put the Workbook_Open in Module 5.

The macro that was listed in the previous reply works when I run the macro after Excel comes up, but doesn't start off automatically.
 
Upvote 0
Mr. Wizard....

The Workbook_Open Event only works if it is placed in the "ThisWorkBook" module. :wink:


If you put a macro named Auto_Open() in a regular module, it will run whenever the workbook is manually opened (unless the user holds down the shift key while opening the file). If you put a macro named Workbook_Open() in the workbook code module that macro which will run upon opening the workbook. If both are present, both will run. The Workbook_Open macro will run first. You can access the workbook code module by displaying the Visual Basic project explorer, and double clicking on the ThisWorkbook object.

If code from another workbook opens a file containing Auto_Open() or Workbook_Open() macros, the Auto_Open macro() will not run, but the Workbook_Open() macro will run. To have the Auto_Open procedure run when the workbook is opened by Visual Basic code, the code opening the workbook can run the Auto_Open() procedure using this statement:

Explaination Source: Robert W. Flanagan: "Microsoft Excel Visual Basic Macros Made Easy "
 
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,172
Members
448,870
Latest member
max_pedreira

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