ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How can I set up a Macro to automatically run when I open a speci. (https://www.excelbanter.com/excel-discussion-misc-queries/3758-how-can-i-set-up-macro-automatically-run-when-i-open-speci.html)

Rick Martin

How can I set up a Macro to automatically run when I open a speci.
 
How can I set up a Macro to automatically run when I open a specific Excel
file?

Nick Hodge

Rick

Still supported. (In a standard module)

Sub Auto_Open()
'Code here
End Sub

Preferred (XL97 up), use the workbook_Open() event, thus

Private Sub Workbook_Open()
'Code goes here
End Sub

The latter will fire even if the workbook is open through code

For an explanation of different module types and how to implement, go to

http://www.nickhodge.co.uk/vba/vbaimplement.htm

BTW, where are you posting from, I'm very interested as we seem to have a
huge number of posts recently that have had the subject line truncated? It
looks like the web interface to the newsgroups at Microsoft, but if you
could send the URL it would be great

Thanks

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"Rick Martin" <Rick
wrote in message
...
How can I set up a Macro to automatically run when I open a specific Excel
file?





All times are GMT +1. The time now is 01:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com