×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Executing a VB Form on opening an Excel Workbook

Executing a VB Form on opening an Excel Workbook

Executing a VB Form on opening an Excel Workbook

(OP)
I am able to execute a for from withing an excell workbook, but throught the aid of an "main Menu" type button.  I am looking to execute my form as the particular excel file is opened.  Anyone have any Idea's?

RE: Executing a VB Form on opening an Excel Workbook

There is a pre-defined sub called Workbook_Open().  Use the tools menu to display the Visual Basic editor (ALT+F11 in Excel 97).  In the Project Browser window (usually found at top left of screen), double-click the "ThisWorkbook" object to display the code window for the workbook itself.  The code window will now show two drop downs at the top.  Change the left drop-down to say "Workbook" (shows "General" as default).  This will automatically create the stub for the Workbook_Open() procedure.  Within this procedure stub, type in "Load frmMyForm" (without the quotes) and substitute the frmMyForm name with the name of your form.

When the workbook is opened (provided the user chooses NOT to disable macros), your form will be displayed.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources