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

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.