ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   AutoRun (https://www.excelbanter.com/excel-programming/401194-autorun.html)

Usen

AutoRun
 
Hi,

I have a worksheet that loads automatically (Xlstart folder), but hidden.

There is a few macros in it, but what I want to acheive is when I open a
file I want a macro to execute, but I don't know where to put it.

It doesn't work on the workbook_open sub, since this one starts only when
the initial file loads.

Thanks.



Chip Pearson

AutoRun
 
If you want code to run when *any* workbook is opened, you need to use
application-level events, specifically the App_WorkbookOpen event (for
opening existing workbooks) and/or the App_NewWorkbook event (when a new
workbook is created). See http://www.cpearson.com/excel/AppEvent.aspx for
details and example code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)



"Usen" wrote in message
...
Hi,

I have a worksheet that loads automatically (Xlstart folder), but hidden.

There is a few macros in it, but what I want to acheive is when I open a
file I want a macro to execute, but I don't know where to put it.

It doesn't work on the workbook_open sub, since this one starts only when
the initial file loads.

Thanks.



Usen

AutoRun
 
Thanks, it works great.


"Chip Pearson" a écrit dans le message de news:
...
If you want code to run when *any* workbook is opened, you need to use
application-level events, specifically the App_WorkbookOpen event (for
opening existing workbooks) and/or the App_NewWorkbook event (when a new
workbook is created). See
http://www.cpearson.com/excel/AppEvent.aspx for
details and example code.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)



"Usen" wrote in message
...
Hi,

I have a worksheet that loads automatically (Xlstart folder), but hidden.

There is a few macros in it, but what I want to acheive is when I open a
file I want a macro to execute, but I don't know where to put it.

It doesn't work on the workbook_open sub, since this one starts only when
the initial file loads.

Thanks.






All times are GMT +1. The time now is 07:13 AM.

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