ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   AutoOpen in excel? (https://www.excelbanter.com/excel-programming/330510-autoopen-excel.html)

bilisa

AutoOpen in excel?
 
Hi,

I want my macro to start automatically when I create a new document based on
a template. In Word I normally use AutoOpen() and AutoNew(). Are there
similar functions in Excel that do the same thing?


William Benson

AutoOpen in excel?
 
Store a subprocedure called Auto_Open in Personal.xls.

If you have not created any macros, you may not have a personal macro
workbook already created and residing in Excel's startup folder. If this is
the case, the best way I have found to get one generated is to turn on the
macro recorder, designate the Personal Macro Workbook as the place the macro
should be stored, click around a bit, turn off the recorder, and go to the
VB editor to look for the project in Personal.xls. There will be a "Module1"
module by this time and some code indicating your recent clicking/cell
selecting. You can get rid of the macro you created, and use this module
space to yupe a new macro. Such as ...

Sub Auto_Open
'put more VBA code here
End sub

good luck...

Bill
"bilisa" wrote in message
...
Hi,

I want my macro to start automatically when I create a new document based
on
a template. In Word I normally use AutoOpen() and AutoNew(). Are there
similar functions in Excel that do the same thing?




Tom Ogilvy

AutoOpen in excel?
 
If it is a specific template, in that template, use the workbook.open event

http://www.cpearson.com/excel/events.htm

if you mean everytime a workbook is created, regardless of the template
used, the you would need to instantiate application level events where there
is an event for trapping the creation of new workbooks

http://www.cpearson.com/excel/appevent.htm

which should get you started.

these links are to Chip Pearson's site.

--
Regards,
Tom Ogilvy


"bilisa" wrote in message
...
Hi,

I want my macro to start automatically when I create a new document based

on
a template. In Word I normally use AutoOpen() and AutoNew(). Are there
similar functions in Excel that do the same thing?




William Benson

AutoOpen in excel?
 
a much better response, I didn't read the question thoroughly...


"Tom Ogilvy" wrote in message
...
If it is a specific template, in that template, use the workbook.open
event

http://www.cpearson.com/excel/events.htm

if you mean everytime a workbook is created, regardless of the template
used, the you would need to instantiate application level events where
there
is an event for trapping the creation of new workbooks

http://www.cpearson.com/excel/appevent.htm

which should get you started.

these links are to Chip Pearson's site.

--
Regards,
Tom Ogilvy


"bilisa" wrote in message
...
Hi,

I want my macro to start automatically when I create a new document based

on
a template. In Word I normally use AutoOpen() and AutoNew(). Are there
similar functions in Excel that do the same thing?







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

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