Conversion of Word 2003 Templates to Word 2007

B

BirdMan

I have a number of personalized templates in Word 2003 (primarily Avery
binder spine inserts) that I need to update to Word 2007 templates.

It appears that the only way to do that is to open each one individually and
save in 2007 format. That is amazingly time consuming.

Any other suggestions?
 
J

Jay Freedman

BirdMan said:
I have a number of personalized templates in Word 2003 (primarily
Avery binder spine inserts) that I need to update to Word 2007
templates.

It appears that the only way to do that is to open each one
individually and save in 2007 format. That is amazingly time
consuming.

Any other suggestions?

How about automating it with a macro? See
http://www.gmayor.com/installing_macro.htm if needed.

Sub ConvertTemplates()
' Convert every Word 97-2003 format template in the
' User Templates folder to Word 2007 .dotx format.

' Note: ALL macros will be discarded silently! If you
' need to keep the macros, change the "x" in the
' assignment of myNewFile to "m" and change the FileFormat
' argument in the SaveAs command from wdFormatXMLTemplate
' to wdFormatXMLTemplateMacroEnabled.

Dim aTemplate As Document
Dim myFile As String
Dim myNewFile As String
Dim PathToUse As String
Dim resp As Integer

' included to avoid compile error if run in Word 2003 or earlier:
Const wdFormatXMLTemplate = 14

If Val(Application.Version) < 12 Then
MsgBox Prompt:="This macro requires Word 2007."
Exit Sub
End If

resp = MsgBox(Prompt:="If there are any *.dotx templates in " & _
"the User Templates folder," & vbCr & "move them out so they " & _
"won't be overwritten." & vbCr & vbCr & "Proceed?", _
Buttons:=vbYesNo, Title:="Template Converter")

If resp = vbNo Then Exit Sub

PathToUse = Options.DefaultFilePath(wdUserTemplatesPath) & "\"

myFile = Dir$(PathToUse & "*.dot")

While myFile <> ""
' myFile will also pick up dotx and dotm files, so avoid them
If LCase(Right$(myFile, 3)) = "dot" Then
' suppress auto macros and save dialogs
WordBasic.DisableAutoMacros 1
Application.DisplayAlerts = wdAlertsNone

' Open a copy of the template as a new template
Set aTemplate = Documents.Add(Template:=PathToUse & myFile, _
NewTemplate:=True)

' Change the extension -- NOT macro-enabled template
myNewFile = myFile & "x"

' Convert to XML format and save it, then close
With aTemplate
.Convert
.SaveAs FileName:=PathToUse & myNewFile, _
FileFormat:=wdFormatXMLTemplate
.Close
End With
End If

'Next file in folder
myFile = Dir$()
Wend

' Restore normal functions
WordBasic.DisableAutoMacros 0
Application.DisplayAlerts = wdAlertsAll
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

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