Batch convert .doc to .docx (and equivilent for other office formats)?

7

5

I wish to convert a large number of office files into the newer versions, eg. .doc's to .docx's. I need something for all of the difference MS office application filetypes.

What is the best tool for the job(Windows xp)?

I'm looking for something free (beer), and can manage a large number of files (doing this by manually opening files just isn't viable).

Thanks.

Dmatig

Posted 2009-08-29T15:58:52.653

Reputation: 1 622

Answers

7

The answer is structured to convert all documents, not just Word documents.

Say you got tons of Excel sheets, PowerPoint presentations and Word documents on your computer that were written in Office XP or 2003. How do you convert all these files to the new Office 2007 format.

One option is that you open all of them in the associated Office program and manually save them in the newer (docx, xlsx or pptx) format. Or follow these steps and convert all documents in one go.

Step 1: Download Migration Manager kit and extract it into a new folder - say: c:\office.

office-pack

Step 2: Download and install the Office Pack - this step is required even if you have Microsoft Office 2007 already installed on your computer.

Step 3: Assuming that you extracted the Office Manager files in c:\office directory, go c:\office\tools, open ofc.ini using notepad and add the following line.

fldr=c:\users\labnol\documents

This refers to the folder location that holds your office files. I am pointing this to my Documents folder but it could be different on your machine.

Step 4: Open command prompt and go to c:\office\tools. There you’ll see a utility called ofc.exe - this is the Office File Converter that will convert all old Office files to the new 2007 Office document format in bulk. Run.

convert-docs

Immediately all old Office files in that folder (and sub-folders) will get converted to the new format and are saved in a new folder.

This utility works with Word (doc to docx), Access databases, PowerPoint (ppt to pptx), Visio diagrams, Excel (xls to xlsx) and Microsoft Project files. The conversion may however fail for password protected documents.

Taken from here.

caliban

Posted 2009-08-29T15:58:52.653

Reputation: 18 979

this doesn't seem to work too well with office 2016, as it mysteriously gives an error "failed to convert" without logging anything. The wordconvert below works. – Dan – 2016-10-19T01:08:50.857

Thanks, exactly what i needed. It's hard to pick an overall best answer to accept but, this gave me the info i needed so...sorry to you other two :( – Dmatig – 2009-09-02T17:24:31.273

not to worry folks - once I dream up of a tough qn i'll put this reputation points to work, and return it to the SU community. Thanks dmatig! – caliban – 2009-09-02T17:28:29.160

6

The following vba macro will convert all the docs in a selected folder

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

credit to Graham Mayor - Word MVP

Molly7244

Posted 2009-08-29T15:58:52.653

Reputation:

2

nik

Posted 2009-08-29T15:58:52.653

Reputation: 50 788

1

I made a batch file for use with Office 2010. It is free, but office isn't. This DOES delete the original file. If you don't want it to, get rid of the second line. Paste the code into a batch file.

for /r "SOME PATH TO TRAVERSE" %%a in ("*.doc") do (
"YOUR PATH MIGHT BE DIFFERENT C:\Program Files\Microsoft Office\Office14\Wordconv.exe" -oics -nme "%%a" "%%ax"
del "%%a"

)

Karl Henselin

Posted 2009-08-29T15:58:52.653

Reputation: 129

path for office 2016 (x86 ver): C:\Program Files (x86)\Microsoft Office\root\Office16\Wordconv.exe – Dan – 2016-10-19T01:09:14.090

1This is a poor solution compared to the command line tool that exists by Microsoft. – Ramhound – 2012-12-10T18:32:10.063

Doesn't require the Office Pack though. – Matt Lyons – 2013-04-16T07:24:33.363