Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Excel VBA application start

Status
Not open for further replies.

Statesman

Mechanical
Jul 26, 2002
15
I have written a VBA application for Excel, which involves the user filling in a form.
Is there a simple way to have this form load up automatically when the workbook is opened ?
At the moment Im thinking of using a button with a macro attached to it, but would obviously prefer if the form came up straight away.

Regards
Stephen
 
Replies continue below

Recommended for you

When i look to HELP on Auto_open. There is nothing regarding it. Are you maybe thinking Im using the full VB programme ? I only have VBA which is included in Excel ?
 
Im really looking to use something similar to the following :-

Private Sub Worksheet_Activate()
Load UserForm1
UserForm1.Show

End Sub

However, when Excel loads up, with this worksheet open, the userform doesnt activate, until you go away from this worksheet, and then go back into it. Is there anyway I can force the userform to be loading on the initial startup of the workbook.

Actually, just thiniking about it, as I typed this I tried the following and it works !!! :-

Private Sub Workbook_Open()

Load UserForm1
UserForm1.Show

End Sub

Just shows you, sometimes just thinking about it on a forum, helps you. ;o)
 
One of my programs starts this way:the UserForm_1 contains a sort of a message box with four CommandButtons. It opens automatically whenever I open the workbook that contains it and the code in UserForm_1 is:

Sub auto_open()
End Sub

A click on CommandButton1 calls a sub to enter new data into a UserForm_2's TextBoxes:

Private Sub Commandbutton1_Click()
Rem new data entry
UserForm2.Show
…..
Rem Block of codes
…..
UserForm2.Hide
End Sub

A click on CommandButton2 calls a sub to correct data on a spredsheet:

Private Sub Commandbutton2_Click()
Rem correct entries
MsgBox "correction"

block of codes for correcting entries on a spreadsheet
…..
End Sub

A click on CommandButton3 alows viewing data on a spredsheet:
Private Sub Commandbutton3_Click()
Rem view data
MsgBox "view"

block of codes for viewing data on a spreadsheet
…..
End Sub

And a click on CommandButton4 calls a sub to exit activities Private Sub Commandbutton4_Click()
MsgBox "exit"


block of codes to exit
…..
End Sub

I am sure that more experienced programmer would do it better, but it works.
M777182
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor