I have over 14,000 Word files in .doc format. Can I batch-convert them to
.docx format. It would be unrealistic to convert them one-by-one.
Sub SaveAllAsDOCX()
Dim strFileName As String
Dim strDocName As String
Dim strPath As String
Dim oDoc As Document
With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
strPath = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
End With
If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
If Left(strPath, 1) = Chr(34) Then
strPath = Mid(strPath, 2, Len(strPath) - 2)
End If
strFileName = Dir$(strPath & "*.doc")
While Len(strFileName) <> 0
Set oDoc = Documents.Open(strPath & strFileName)
strDocName = ActiveDocument.FullName
intPos = InStrRev(strDocName, ".")
strDocName = Left(strDocName, intPos - 1)
strDocName = strDocName & "docx"
oDoc.SaveAs FileName:=strDocName, _
FileFormat:=wdFormatDocumentDefault
oDoc.Close SaveChanges:=wdDoNotSaveChanges
strFileName = Dir$()
Wend
End Sub
http://www.gmayor.com/installing_macro.htm
I thought Microsoft would have furnished a built-in converter to do the job,
since it wants its Office customers to use the new file format. Oh well...
One other question in this respect:
I used my normal.dot file from Office XP when I installed Office 2007 and it
works fine with Office 2007. Will the macros in the old normal.dot file that
I brought over work with the new .docx format?
As I said earlier Word 2007 opens and saves in doc format without the need
for conversion.
Word needs to create its own normal template (normal.dotm) into which you
can copy macros etc. It should do this during installation if another Word
version had been previously installed.
Most of the old macros should work, but there are some parts of the vba code
that have changed and some functions that are no longer available in the
same form.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
You wrote something that may save me a good deal of time in terms of using
macros:
"Word needs to create its own normal template (normal.dotm) into which you
can copy macros etc. It should do this during installation if another Word
version had been previously installed."
Can you tell me how I could copy the contents of normal.dot to normal.dotm?
(Both are currently in the Templates folder.) I am now using normal.dot but I
want to somehow get its contents into normal.dotm because Word 2007 will not
permit me to build a new macro in normal.dot. and I need to add one or two
macros to the 25 or so I currently use.
Thanks.
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>