?
Solved

Batch Convert 2007 Word Douments to Templates

Posted on 2011-09-12
6
Medium Priority
?
237 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
New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

 
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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Online collaboration can help businesses be more efficient, help employees grow their skills and foster a team environment.
This article shows how to convert a multi-page PDF file into multiple image files, with one image file created for each page of the PDF. It does this by utilizing an excellent, free software package called GraphicsMagick. The solution is amazingly s…
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.
We often encounter PDF files that are pure images, that is, they do not have text characters, but instead contain only raster graphics. The most common causes of this are document scanning software and faxing software/services that create image-only…
Suggested Courses
Course of the Month10 days, 14 hours left to enroll

770 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