ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Incorrect templates path (https://www.excelbanter.com/excel-programming/322430-incorrect-templates-path.html)

VanS[_2_]

Incorrect templates path
 
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

Jon Peltier[_9_]

Incorrect templates path
 
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/
_______

VanS wrote:

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


VanS[_2_]

Incorrect templates path
 
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\TEmpla teName.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



"Jon Peltier" wrote:

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/
_______

VanS wrote:

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




All times are GMT +1. The time now is 09:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com