Where is the the "Templates" folder?

G

Gérard Ducouret

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
 
C

Charles Kenyon

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.
--
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




--------- --------- --------- --------- --------- ---------
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.
 
J

Jean-Guy Marcil

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

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)

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
G

Gérard Ducouret

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

Gérard Ducouret

Sorry, this macro reads only the templates used by the opened documents!

Gérard
 
C

Charles Kenyon

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.
--
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




--------- --------- --------- --------- --------- ---------
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.
 
J

Jean-Guy Marcil

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.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
G

Gérard Ducouret

Thanks a lot

Gérard

Charles Kenyon said:
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.
--
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




--------- --------- --------- --------- --------- ---------
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.
 
J

Jean-Guy Marcil

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?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
C

Charles Kenyon

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.
--
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




--------- --------- --------- --------- --------- ---------
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.
 
J

Jean-Guy Marcil

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.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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