Thread: Templates
View Single Post
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 264
Default Templates

AFAIK you have to open the files. You could put them in a batch
folder and process the folder with a macro:

Public Sub BatchAttachTemplate()
Dim myFile As String
Dim PathToUse As String
Dim myDoc As Document
'Close any open documents
If Documents.Count 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
'Get the folder containing the files
MsgBox "When the Copy dialog box appears drill down to the applicable
folder and click on Open.", , "User Instructions"
With Dialogs(wdDialogCopyFile)
If .Display 0 Then
PathToUse = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
End With
If Left(PathToUse, 1) = Chr(34) Then
PathToUse = Mid(PathToUse, 2, Len(PathToUse) - 2)
End If
'Set the directory and type of file to batch process
myFile = Dir$(PathToUse & "*.doc")
While myFile ""
'Open document
Set myDoc = Documents.Open(PathToUse & myFile)
'Ensure Word will sense change and resave
myDoc.Saved = False
With myDoc
.AttachedTemplate = "Test.dot" 'Change to reflect your template
name
End With
myDoc.Close SaveChanges:=wdSaveChanges
'Process next file in folder
myFile = Dir$()
Wend
End Sub


On Apr 20, 12:42 pm, Francois
wrote:
Is it possible to apply a Word template to multiple files at once without
having to open each file separately?
--
Francois