Formerly Best Training
© 2024 STL. All Rights Reserved.
All prices offered for business users and exclude VAT. E&OE
2nd Floor, CA House, 1 Northey Street, Limehouse Basin, London, E14 8BT. United Kingdom
Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Macro to run on file opening
Resolved · High Priority · Version 2007
Galina has attended:
Excel VBA Intro Intermediate course
Excel VBA Advanced course
Hi! I would like my macro to run when I open the file. Can I code that? Thanks!
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. |
We'll call during UK business hours
Server loaded in 0.07 secs.