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

STL - Formerly Best Training Solutions Through Learning
TrustPilot
Excellent
Request Callback We will call you back
0207 987 3777 Call for assistance
Your Basket Basket is empty
macro run file opening

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

ResolvedVersion 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:

Using the Quick Access Toolbar in Excel2010

The Quick Access Toolbar is included in virtually every Office product, including Outlook 2010, Word 2010, Excel 2010, and PowerPoint 2010.

You will find the Quick Access Toolbar in the top-left side of the window. To begin, click the Customize button (it's the little black arrow at the end of the toolbar).

Simply click the commands you want to include.

Virtually any command can be added to the Quick Access Toolbar. Click the More Commands option and a new window will open from where you can browse the commands including those not on the ribbon.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.09 secs.