Re: Apply a Template to all documents in folder and subfolders by Helmut
Helmut
Fri Aug 04 13:50:16 CDT 2006
Hi Dave,
>I have created a template that I would like to apply to all documents in a
>specific folder and its subfolders. Is there any way to do so
>programatically?
Many ways, as far as looping recursively through
all folders and subfolders is concerned.
For attaching a template:
ActiveDocument.AttachedTemplate = "c:\edit\2003\co-english.dot"
MsgBox ActiveDocument.AttachedTemplate ' for testing
ActiveDocument.Save
For looping through the folders,
it depends on how many files there are?
50, 500, 5,000, 50,000, 500,000?
Don't laugh. I administrate more than that.
For very many files I create a txt.file
containing all the foldernames and filenames,
like this, in the command-shell:
K:\>dir *.doc /b/s > c:\mydir.txt
Just to get you started.
--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"