Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Batch Convert 2007 Word Douments to Templates

Posted on 2011-09-12
6
Medium Priority
?
238 Views
Last Modified: 2012-08-14
Is there a easy way to convert 2007 Word Documents into Templates?
0
Comment
Question by:covxx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 36524611
You could just rename them and move them to where you keep your templates.
0
 

Author Comment

by:covxx
ID: 36524708
I'm not a great office person could you expalin. What she has is a couple hundred Word doc's that people keep making changes to. I think that we will cut the problems down if they are turned into templates and when they go to save it will prompt them for a new file name. Thanks for your help!
0
 
LVL 31

Expert Comment

by:Helen Feddema
ID: 36524953
Sounds like a good idea - but you need more than just saving them as templates, so after the conversion, check to see if they need any special features that are relevant to templates, have the right fonts and styles, etc.

Here is some code that will convert all the .doc files in a selected folder to .dot files (Word 97/2003 templates).  It is Word VBA, and requires a reference to the Scripting Runtime Library.

Public Sub ConvertDocsToTemplates()
'Created by Helen Feddema 12-Sep-2011
'Last modified by Helen Feddema 12-Sep-2011

On Error GoTo ErrorHandler

   Dim fld As Scripting.Folder
   Dim fil As Scripting.File
   Dim strFolder As String
   Dim fso As New Scripting.FileSystemObject
   Dim strFile As String
   Dim strFileAndPath As String
   Dim doc As Word.Document
   
   strFolder = "G:\Documents\Documents to Convert"
   Set fld = fso.GetFolder(strFolder)
   
   For Each fil In fld.Files
      strFile = fil.Name
      Debug.Print "File: " & strFile
      If Right(strFile, 3) = "doc" Then
         strFileAndPath = strFolder & "\" & strFile
         Set doc = Application.Documents.Open(strFileAndPath)
         doc.SaveAs2 FileName:="Test Doc.dot", _
            FileFormat:=wdFormatTemplate
         doc.Close
      End If
   Next fil
   
ErrorHandlerExit:
   Exit Sub

ErrorHandler:
   MsgBox "Error No: " & Err.Number _
      & " in ConvertDocsToTemplates procedure; " _
      & "Description: " & Err.Description
   Resume ErrorHandlerExit

End Sub

Open in new window

0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 31

Expert Comment

by:Helen Feddema
ID: 36524979
I ran this code in Word 2010; for older versions of Word, use SaveAs instead of SaveAs2.
0
 
LVL 31

Accepted Solution

by:
Helen Feddema earned 1000 total points
ID: 36524995
I just realized that I have a hard-coded save name (that's the problem with recording macros!).  Here is is again:
Public Sub ConvertDocsToTemplates()
'Created by Helen Feddema 12-Sep-2011
'Last modified by Helen Feddema 12-Sep-2011

On Error GoTo ErrorHandler

   Dim fld As Scripting.Folder
   Dim fil As Scripting.File
   Dim strFolder As String
   Dim fso As New Scripting.FileSystemObject
   Dim strFile As String
   Dim strFileAndPath As String
   Dim doc As Word.Document
   Dim strSaveName As String
   
   strFolder = "G:\Documents\Documents to Convert"
   Set fld = fso.GetFolder(strFolder)
   
   For Each fil In fld.Files
      strFile = fil.Name
      Debug.Print "File: " & strFile
      If Right(strFile, 3) = "doc" Then
         strFileAndPath = strFolder & "\" & strFile
         Set doc = Application.Documents.Open(strFileAndPath)
         strSaveName = Left(strFile, Len(strFile) - 1) & "t"
         doc.SaveAs2 FileName:=strSaveName, _
            FileFormat:=wdFormatTemplate
         doc.Close
      End If
   Next fil
   
ErrorHandlerExit:
   Exit Sub

ErrorHandler:
   MsgBox "Error No: " & Err.Number _
      & " in ConvertDocsToTemplates procedure; " _
      & "Description: " & Err.Description
   Resume ErrorHandlerExit

End Sub

Open in new window

0
 

Author Closing Comment

by:covxx
ID: 36526599
Thank you very much!
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article provides the solution to a question (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28674207.html) posed here at Experts Exchange. The asker of the question has many JPG images in many folders, and all of t…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question