Making A User Form Automatically Active On File Open

  • Thread starter Thread starter Graham
  • Start date Start date
G

Graham

Hi,

Can I make a user form active whenever the file containing
it is opened? - without manually having to run a procedure
to "show userform" after I've opened the file.

Thanks for any help
Graham
 
Hi Graham

Open the userform in the Workbook open event or Auto_Open macro

Use this sub in a normal module
Alt-F11
Insert>Module in the menubar
paste the sub there
Alt-Q to go back to Excel

Sub Auto_Open()
Userform1.show
End Sub

This will not run if you open the workbook with code
If you place the code in the workbook open event it will also run when
you open the workbook with code.
 
In the ThisWorkbook code module put:

Private Sub Workbook_Open()
Dim myForm As UserForm1
Set myForm = New UserForm1
myForm.Show
Set myForm = Nothing
End Sub
 
"without manually having to run a procedure"

If you don't want to manually do it, you could put the
Show method in the Workbook module under the Open event.
The form wouldn't pop up though if your user disabled the
macros.

-Brad
 
Back
Top