Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I've written some code that will be used in a workbook
template. The code creates a new workbook, does some stuff to it, closes it, and returns to the template. I was using the following code: Windows("Template.xls").Activate But, I've realized that the users will probably be changing the name of the workbook. How can I always return to the workbook in which the macro resides? Thanks in advance! Fred |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Fred,
The ThisWorkbook reference will always refer to the workbook containing the code. So you can write ThisWorkbook.Activate -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Fred" wrote in message ... I've written some code that will be used in a workbook template. The code creates a new workbook, does some stuff to it, closes it, and returns to the template. I was using the following code: Windows("Template.xls").Activate But, I've realized that the users will probably be changing the name of the workbook. How can I always return to the workbook in which the macro resides? Thanks in advance! Fred |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
can't seem to activate an open workbook | Excel Discussion (Misc queries) | |||
activate opened workbook via VBA | Excel Discussion (Misc queries) | |||
Activate Workbook | Excel Discussion (Misc queries) | |||
Activate new workbook with unknown name | Excel Discussion (Misc queries) | |||
Workbook.activate | Excel Discussion (Misc queries) |