Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to have a macro run each time I open a new excel file based upon
a specific template. I saved the macro in the ThisWorkbook module of the template, but still the macro has to be manually run for each new file. Is there a way for new files to autorun the macro in their ThisWorkbook module? ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "hke" wrote in message ... I want to have a macro run each time I open a new excel file based upon a specific template. I saved the macro in the ThisWorkbook module of the template, but still the macro has to be manually run for each new file. Is there a way for new files to autorun the macro in their ThisWorkbook module? Is the macro called Workbook_Open() ? GB |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes it is
------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "hke" wrote in message ... Yes it is ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ Hmm - I asked because I have the following code in a test template: Private Sub Workbook_Open() MsgBox "hi" End Sub It's in the workbook code. It works 100% - every time! So, what are you doing that's different? GB |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Mine is also in the workbook code.
The macro puts the path of the file in the title area. I guess its like this: The file needs to be saved to set the path and therefore nothing happens at opening since the file has not been saved. It would be preferable to have the macro run automatically after save ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "hke" wrote in message ... Mine is also in the workbook code. The macro puts the path of the file in the title area. I guess its like this: The file needs to be saved to set the path and therefore nothing happens at opening since the file has not been saved. It would be preferable to have the macro run automatically after save Can you not save immediately after open? GB |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Put the macro in a general module with a different name such as AddPath
In the BeforeSave event in the workbook module put in code like Application.Ontime Now + TimeValue("00:00:05"),"AddPath" -- Regards, Tom Ogilvy "hke" wrote in message ... Mine is also in the workbook code. The macro puts the path of the file in the title area. I guess its like this: The file needs to be saved to set the path and therefore nothing happens at opening since the file has not been saved. It would be preferable to have the macro run automatically after save ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Autorun macro | Excel Discussion (Misc queries) | |||
AutoRun Macro | Excel Worksheet Functions | |||
autorun a macro | New Users to Excel | |||
Autorun Macro | Excel Discussion (Misc queries) | |||
MACRO AUTORUN | Excel Discussion (Misc queries) |