Automating the application of a template to multiple files
thanks, steve
had other day folder full of documents
dim fd filedialog
dim strfolder string
dim strfile string
dim doc document
'display dialog in user can select folder file saved
set fd = application.filedialog(msofiledialogfolderpicker)
fd
.title = "select folder contains documents."
if .show = -1 then
'the use pressed ok, load variable strfolder path folder selected user , append path separator
strfolder = .selecteditems(1) & "\"
else
'the user pressed cancel
exit sub
end if
end with
'close open documents before beginning
'get new title used each document
strfile = dir(strfolder & "*.doc")
while strfile <> ""
'open document
set doc = documents.open(strfolder & strfile)
doc
.updatestylesonopen = true
.attachedtemplate = "drive:\path\templatename"
.close wdsavechanges
end with
'next file in folder
strfile = dir()
wend
-- hope helps.
doug robbins - word mvp,
dkr[atsymbol]mvps[dot]org
posted via community bridge
"dadofour" wrote in message news:17bd81e7-8dc1-4224-94ce-7c0b45f8fdfc@communitybridge.codeplex.com...
i have ~200 documents apply word 2007 template to. instead of importing styles, etc each document, there elegant/automated way accomplish this? perhaps via command line or batch file?
thanks, steve
doug robbins - word mvp dkr[atsymbol]mvps[dot]org
Microsoft Office > Word IT Pro Discussions
Comments
Post a Comment