View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Activate a template file

workbooks.open filename:=MyName.xlt
set templ = activeworkbook


Or, simpler,

Set WB = Workbooks.Open(Filename:="YourTemplate.xlt")


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"Joel" wrote in message
...
Do the open with a set statement. After a workbook open the opened
workbook
is the active workbook. Set a variable to the active workbook. Later use
the variable to activate the book again

workbooks.open filename:=MyName.xlt
set templ = activeworkbook

'later in the code
templ.activate

"XP" wrote:

Using Office 2003 and Windows XP;

Is there any way to activate a template file after it has already been
opened (but not yet saved)?

I tried recording the file name and writing it into a hidden sheet, then
use
that to activate the file, but it doesn't work, I guess because it is not
yet
saved, but it seems there must be a way to activate it.

I also tried setting an object reference to the file on open, but this
loses
the object reference for some reason, I think because the file being
opened
is an Oracle ADI template file and certain codes run in the background to
connect to Oracle and the object reference is severed in the process.

Can I use a window name perhaps?

Your example code would be most appreciated. Thanks much in advance.