Incorrect templates path

G

Guest

Hello,
I have a VB6, Excel/Word VBA app that runs in Excel and uses the
Application.TemplatesPath property to locate where the templates I created
and stored are-this is the same folder where the standard Word and Excel
templates are located. It works fine under Win XP pro and Office 2003, but in
a testbed under Virtual PC 2004 that is Win 98, Office 97 it grabs the wrong
location.
The correct location under that system should be:
C:\Windows\Application Data\Microsoft\Templates\
but instead it grabs:
C:\Program Files\Microsoft Office\Templates\
This was originally developed under Office 97 before I upgraded and I
believe I used the same code and it worked before.
Any ideas on what the problem is and how to resolve this?
Thanks, God bless
Van
 
J

Jon Peltier

Van -

FWIW, I always store all the files for a given app in the same
directory. Any VB exe, the Excel add-in or workbook, any templates for
Excel, Word, PowerPoint; everything is placed by the installer into:

C:\Program Files\My Program\

This works fine, since my templates are rarely used directly by the user.

That's kind of OT to your post. When investigating VPC last year, I
recall some grumbling about things like default paths. Maybe you could
also ask this question in 'microsoft.public.virtualpc'.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
 
G

Guest

Jon,
A delayed thanks for your helpful reply.
I am thinking perhaps your solution is simplest solution and to just put my
Word and Excel templates in my Program Files\Application
folder. I have Word templates and also Excel workbook and worksheet
templates. For the Word .dot and Excel Workbook templates I can then set the
path in the code. The only problem I am having now is trying to use the add
method of the Worksheet to add the worksheet template to a workbook.
The MS website doesn't give very specific instructions for adding a sheet as
a template. I have tried to add from my template after the last sheet such
as:
Worksheets.Add.Move (after:=
Worksheets(Worksheets.Count),Type:="C:\Path\TEmplateName.xlt")
and also
Worksheets.Add.Move Type:="C:\Path\TEmplateName.xlt"

However, I get error Application-defined or object-defined error message.
Any idea what the right syntax is to get this done.
Thanks again,
Van
 

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

Top