Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
startup macro on condition of filename
Please suggest how to use the startup macro when the filename was open
eg.: when I open report.xls the macro should be autorun but the other files was open the macro notrun thanks, |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
startup macro on condition of filename
arun,
I'm a little confused from your post. To run a macro when a workbook opens, you can name the sub Auto_Open Sub Auto_Open() ' your code End Sub The above will automatically run whenever the workbook that it's contained within is opened. If you're looking to run a particular macro when the workbook is opened from another workbook only, use the Application.Run function from the original workbook. Workbooks.Open Filename:="FileName.xls" Application.Run "'FileName.xls'!MacroName" John "arun" wrote in message ... Please suggest how to use the startup macro when the filename was open ? eg.: when I open report.xls the macro should be autorun but the other files was open the macro notrun. thanks, |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
startup macro on condition of filename
I just got done doing this.. I created a class event inside a addin and then
followed Chip Pearson's advice: You need to use application events to trap for workbook being opened. See www.cpearson.com/excel/appevent.htm for more details. I altered the workbook_open event to continue to execute if the wb.name was correct. I found out later I coded it case-sensitive. "arun" wrote in message ... Please suggest how to use the startup macro when the filename was open ? eg.: when I open report.xls the macro should be autorun but the other files was open the macro notrun. thanks, |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Startup Macro | Excel Discussion (Misc queries) | |||
starting a macro at startup | Excel Discussion (Misc queries) | |||
Startup macro | Excel Discussion (Misc queries) | |||
Workbook startup condition | Excel Discussion (Misc queries) | |||
Run a macro at startup | Excel Programming |