Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Is there a way to have a macro automatically run every time an excel workbook is opened, where the macro in question resides in the personal.xls or an add-in rather than being part of the document that is being loaded? Thanks, Ric |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you want to instantiate application level events and have the open event
check each workbook opened to see it is the one - then run the code. see Chip Pearson's site on application level events http://www.cpearson.com/excel/AppEvent.htm -- Regards, Tom Ogilvy "Ric" wrote in message ... Hi, Is there a way to have a macro automatically run every time an excel workbook is opened, where the macro in question resides in the personal.xls or an add-in rather than being part of the document that is being loaded? Thanks, Ric |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tom Ogilvy wrote:
If you want to instantiate application level events and have the open event check each workbook opened to see it is the one - then run the code. see Chip Pearson's site on application level events http://www.cpearson.com/excel/AppEvent.htm "Ric" wrote in message ... Hi, Is there a way to have a macro automatically run every time an excel workbook is opened, where the macro in question resides in the personal.xls or an add-in rather than being part of the document that is being loaded? Thanks, Ric Thanks. This works. I have one annoying problem, though. I now have a macro that runs whenever a workbook is opened that does a search and replace of a text string on each sheet of the workbook. However, now I'm always asked if I want to save changes when I close a workbook, even if the string searched for did not exist in that workbook. Is there any way to do a search and replace but leave the "changed" status of the workbook as unchanged if the text string was not found? Thanks, Ric |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
workbooks("MyWorkbook.xls").Saved = True
will mark the workbook as unchanged. so if your macro makes not changes, have it set this property to true after it has done its search and found no match. -- Regards, Tom Ogilvy Ric wrote in message ... Tom Ogilvy wrote: If you want to instantiate application level events and have the open event check each workbook opened to see it is the one - then run the code. see Chip Pearson's site on application level events http://www.cpearson.com/excel/AppEvent.htm "Ric" wrote in message ... Hi, Is there a way to have a macro automatically run every time an excel workbook is opened, where the macro in question resides in the personal.xls or an add-in rather than being part of the document that is being loaded? Thanks, Ric Thanks. This works. I have one annoying problem, though. I now have a macro that runs whenever a workbook is opened that does a search and replace of a text string on each sheet of the workbook. However, now I'm always asked if I want to save changes when I close a workbook, even if the string searched for did not exist in that workbook. Is there any way to do a search and replace but leave the "changed" status of the workbook as unchanged if the text string was not found? Thanks, Ric |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Helpful as usual. Thanks!
Ric Tom Ogilvy wrote: workbooks("MyWorkbook.xls").Saved = True will mark the workbook as unchanged. so if your macro makes not changes, have it set this property to true after it has done its search and found no match. Ric wrote in message ... Tom Ogilvy wrote: If you want to instantiate application level events and have the open event check each workbook opened to see it is the one - then run the code. see Chip Pearson's site on application level events http://www.cpearson.com/excel/AppEvent.htm "Ric" wrote in message ... Hi, Is there a way to have a macro automatically run every time an excel workbook is opened, where the macro in question resides in the personal.xls or an add-in rather than being part of the document that is being loaded? Thanks, Ric Thanks. This works. I have one annoying problem, though. I now have a macro that runs whenever a workbook is opened that does a search and replace of a text string on each sheet of the workbook. However, now I'm always asked if I want to save changes when I close a workbook, even if the string searched for did not exist in that workbook. Is there any way to do a search and replace but leave the "changed" status of the workbook as unchanged if the text string was not found? Thanks, Ric |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro not finishing due to loading workbook | Excel Discussion (Misc queries) | |||
Excel Launching and not automatically starting a new workbook | Excel Discussion (Misc queries) | |||
personal macro workbook just stopped loading | Excel Discussion (Misc queries) | |||
How to stop Excel remembering/loading macro from previously opened Workbook | Excel Discussion (Misc queries) | |||
launching excel icon results in not opening workbook | Excel Discussion (Misc queries) |