Opening a template .xls with VBA code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using the office 2000 package. Can anyone tell me how I can open a .xlt
file via code? The methods I have tried all seem to open the .xlt and an
instance of itself and open up as a .xls file?

BTW I have posted a similar question on another newsgroup(with no luck so
far). As soon as I get find a solution I will be sure to update both groups
as to avoid potentially duplicate efforts.

Thanks,

IXLINXL - not
 
Here is the code that I use to opne a template called "TreeTemplate.xls". I
keep the template in the same folder as the workbook that calls the code.
The xls file should be closed when the cjode is run.

strCurrentExcelPath = ActiveWorkbook.Path 'assign path information

Workbooks.Open Filename:= _
strCurrentExcelPath & "\TreeTemplate.xlt", Editable:=True
'open template for new file

Stan Shoemaker
Palo Alto, CA
 
Are you asking how to create a new workbook based on a template?

workbooks.add template:="C:\myworkbook.xlt"

===
It's not usually necessary to post to multiple newsgroups. But if you're going
to do it, it would be better to cross post (include all the newsgroups in your
header) and post it once.

Multiposting (sending separate posts to separate newsgroups) does make it more
difficult for you (to consolidate all the responses), and can duplicate effort.

(And the part that I'd hate--You don't get the best combined response--someone
sees an answer that can be made better/different.)
 
Sorry about the multiple post....

I guess I need to try and be clearer on my question.

I have created an electronic expense claim. It has a bunch of neat
functionality like an email button that when pressed emails a copy to their
supervisor and a save button that saves a copy to the users "my documents'
folder.

Anyway it built on an Excel template that over 100 people access from a
shared drive. Inside the template itself there is a Control sheet that
contains data that needs to be updated weekly.

I am training to build some code that will open the template itself so that
I can modify it and then save it again so that the next day anyone who uses
it will have all of the latest data.

Here is another description of what I am trying to do. I want to use code to
do the same thing that happens when you right click on an .xlt file and then
click "open". It opens the template itself and not an instance of it.

Is that a more clear explanation?
 
Dave-

I misunderstood your original question. To open the template file itself,
you want to add the argument "Editable = True" to the Workbooks.Open
statement.

e.g. Workbooks.Open Filename:= _
"C:\PathName\MyTemplate.xlt", Editable:=True

Stan Shoemaker
Palo Alto, CA
 
Thank-You, It seems so simple now :0)

stanshoe said:
Dave-

I misunderstood your original question. To open the template file itself,
you want to add the argument "Editable = True" to the Workbooks.Open
statement.

e.g. Workbooks.Open Filename:= _
"C:\PathName\MyTemplate.xlt", Editable:=True

Stan Shoemaker
Palo Alto, CA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top