macro run file opening

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

TrustPilot

starstarstarstarstar Excellent

  • Home
  • Courses
  • Promotions
  • Schedule
  • Formats
  • Our Clients

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Macro to run on file opening

Macro to run on file opening

resolvedResolved · High Priority · Version 2007

Galina has attended:
Excel VBA Intro Intermediate course
Excel VBA Advanced course

Macro to run on file opening

Hi! I would like my macro to run when I open the file. Can I code that? Thanks!

RE: macro to run on file opening

Hi Galina

Thanks for your question

This is easy to do

You need to write your code in the open event of the workbook object

In your VBE look at your project explorer. You will see a module for each worksheet, and one for the workbook. Double click on the workbook module. Above the code window click on the object list (Left most combo, currently showing "General"). Select Workbook from the list.

In the right most (procedure) combo box, choose Open. You will now have created an On Open event. Any code you place in here will run when the workbook opens

Hope this is useful
Regards

stephen


 

Excel tip:

Switch between workbooks ni EXCEL.

use Alt-TAB to switch between workbooks.

View all Excel hints and tips


Server loaded in 0.07 secs.