Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2006

Tip: Looking for answers? Try searching our database.

Where is the the "Templates" folder?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gérard Ducouret - 11 Apr 2006 16:46 GMT
Hello,
I already use the following instruction which find where is the "My
Documents" folder :
CreateObject("wscript.shell").SpecialFolders("mydocuments")
Is there a similar instruction to find where is the "Templates" folder for
Ms Word (the macro shall run on a lot of PCs with different configurations.
Thanks ahead.

Gérard
Charles Kenyon - 11 Apr 2006 16:54 GMT
There are three templates folders that Word cares about and can set. These
are the User Templates Folder, the Workgroup Templates Folder, and the Word
Startup folder. All can be set by the user and have vba constants. The
defaults differ both by version of Word, Operating System, and network
configuration.
Signature

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!

My criminal defense site: http://addbalance.com
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

> Hello,
> I already use the following instruction which find where is the "My
[quoted text clipped - 6 lines]
>
> Gérard
Jean-Guy Marcil - 11 Apr 2006 16:55 GMT
Gérard Ducouret was telling us:
Gérard Ducouret nous racontait que :

> Hello,
> I already use the following instruction which find where is the "My
[quoted text clipped - 5 lines]
>
> Gérard

There are two basic templates folders (and I am not talking about the global
template and add-in folders):

Dim UserTemplatePath As String
Dim GroupTemplatePath As String

TemplatePath = Options.DefaultFilePath(wdUserTemplatesPath)
GroupTemplatePath = Options.DefaultFilePath(wdWorkgroupTemplatesPath)

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 

Gérard Ducouret - 11 Apr 2006 17:21 GMT
Merci Jean-Guy ! Ca marche!
Thanks a lot ! That works !

Gérard

> Gérard Ducouret was telling us:
> Gérard Ducouret nous racontait que :
[quoted text clipped - 17 lines]
> TemplatePath = Options.DefaultFilePath(wdUserTemplatesPath)
> GroupTemplatePath = Options.DefaultFilePath(wdWorkgroupTemplatesPath)
Gérard Ducouret - 11 Apr 2006 17:38 GMT
The following macro finds only one template : normal.dot, while I have 4
others templates in the same folder.
Where is the problem ?
Thanks

Gérard

Sub FindMyTemplate()
Dim aTemp As Object, i As Integer
For Each aTemp In Templates
   i = i + 1
   MsgBox Templates(i).FullName & "Nombre de modèles : " & i & "/" &
Templates.Count
   If aTemp.Name = "Fiche Pilotage Multi WP.dot" Then aTemp.Save
'Never find this one !
Next aTemp
End Sub
Gérard Ducouret - 11 Apr 2006 18:13 GMT
Sorry, this macro reads only the templates used by the opened documents!

Gérard

> The following macro finds only one template : normal.dot, while I have 4
> others templates in the same folder.
[quoted text clipped - 13 lines]
> Next aTemp
> End Sub
Charles Kenyon - 11 Apr 2006 18:45 GMT
It actually reports any loaded templates, including Add-Ins, since they are
a part of the Templates collection.
It does not report the attached template.
Signature

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!

My criminal defense site: http://addbalance.com
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

> Sorry, this macro reads only the templates used by the opened documents!
>
[quoted text clipped - 17 lines]
>> Next aTemp
>> End Sub
Gérard Ducouret - 11 Apr 2006 21:48 GMT
Thanks a lot

Gérard

> It actually reports any loaded templates, including Add-Ins, since they are
> a part of the Templates collection.
[quoted text clipped - 20 lines]
> >> Next aTemp
> >> End Sub
Jean-Guy Marcil - 11 Apr 2006 22:03 GMT
Charles Kenyon was telling us:
Charles Kenyon nous racontait que :

> It does not report the attached template.

Are you sure?
Whenever I have used it, the attached template was always in the Templates
collection, or are we writing about different things here?

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 

Charles Kenyon - 14 Apr 2006 06:15 GMT
I had tried it and it didn't show my attached template but did show 18
Add-Ins plus normal.dot. Maybe I blinked. I just tried it again and the
attached template showed up as the first in the templates displayed.
Signature

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!

My criminal defense site: http://addbalance.com
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

> Charles Kenyon was telling us:
> Charles Kenyon nous racontait que :
[quoted text clipped - 4 lines]
> Whenever I have used it, the attached template was always in the Templates
> collection, or are we writing about different things here?
Jean-Guy Marcil - 14 Apr 2006 16:06 GMT
Charles Kenyon was telling us:
Charles Kenyon nous racontait que :

> I had tried it and it didn't show my attached template but did show 18

18? Wow!

> Add-Ins plus normal.dot. Maybe I blinked. I just tried it again and

Probably!

> the attached template showed up as the first in the templates
> displayed.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 

Jean-Guy Marcil - 11 Apr 2006 20:15 GMT
Gérard Ducouret was telling us:
Gérard Ducouret nous racontait que :

> The following macro finds only one template : normal.dot, while I
> have 4 others templates in the same folder.
> Where is the problem ?

The Templates collection does not refer to *.dot files in a folder, but to
loaded global templates (From the Start-up folder, or anywhere else if they
were loaded), the attached template to the currently active document and
Normal.dot, which is a special case.

To get a list of all the *.dot files in a folder, use the File System Object
or the Dir function.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.