Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I display a userform everytime I open a file??

Status
Not open for further replies.

gautammalkani

Technical User
Sep 29, 2003
51
US
Hi all

I have used the following code :

Private Sub Workbook_Open()
UserForm1.Show
End Sub

My userform1 does not display. Do I need to change any settings anywhere?

Thanks for your help.

Gautam
 
Gautam,

You have used the correct syntax so this should work. However, where is the Workbook_Open sub located? It should be in the ThisWorkbook code module.


Regards,
Mike
 
The code you posted will work. Do you have your Security Level set to High? If so, this could be automatically disabling your macros. Are you being prompted to enable macros when you open this workbook?
 
Hi Dave and Mike

Dave-> My security level is at medium and my macros are being prompted to be enabled when i open any workbook

Mike-> I have placed the workbook_open sub in sheet1. I do not have a "ThisWorkbook" module. If it is possible, please explain what exactly I am doing wrong.

Thanks for your help, guys. I really appreciate it

Cheers

Gautam
 
You have to go in VBE (Alt+F11).

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks for your help. That worked. I made a very silly mistake. Thanks for pointing that out. Appreciate all your help

Cheers

Gautam
 
Adding to PHV's comment:

In the VBE (Visual Basic Editor), left-hand window (Project Explorer), you should see VBAProject (Workbook Name here). Click on the ThisWorkbook entry then the left icon just below the Project Explorer window titlebar. Then, in the code window (larger window on right-hand side of the screen) click on the left dropdown and choose Workbook. This will by default add the Workbook_Open procedure shell to the code window. Just add your call to Userform1.Show.


Regards,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top