June 2010 - Posts

Batch Convert *.docx files to *.doc : an easy approach

Since the time when Office 2007 came into light, the compatibility issues of .docx files put Office 2007 into some kind of shade. People habituated to use Office 2000 or 2003 couldn’t easily migrate to the whole new Office 2007. This is still a problem in Nepal. Today also, most of the organizations have Office 2003 installed, since they find Office 2007 much much tough to operate.

Well, I sort of came into a trap of such scenario. My dad has all of his notes typed in Office 2007 and he did save them in .docx format, but his office personnels use Office 2003. So, what could be done?? The best answer was Upgrade to Office 2007. Wow!! Great Idea, am DONE ! ! !

The other option was, try and convert all those .docx files to .doc. So, if there are around 120/130 documents, you would need to open all of them and then save them one by one to .doc format. So, if one file, lets suppose takes 1 mins then for 120 files, we would be wasting our precious 2 hours. So, I had a look at some tricky approach available in MS-WORD.

First of all, we need to fix a directory so that every files we need to convert to .doc, we keep them here. This will be understood a bit later. This means that, create a directory somewhere, let’s say, in the D Drive of the computer and name it, “TempDocx”.Word_Options

Office_ButtonAnd then open up Microsoft Word and then click on the MS-OFFICE BUTTON.

After then, click on Word Options:


And then click on “Popular” tab and on the right, click on Show Developer Tab in the Ribbon.



So this brings up the Developer tab in our Ribbon.





So, we are done with our preparations.

Now, if you click on the Developer tab, a clickable link called Macros is visible. Click on it


Type in the Macros Name there. For instance, I have given this Macros a name “DocxConvert”.

Then click the Create Button.

This will show up Microsoft Visual Basic Code Editor Window, where we need to type in some code. In our case, we can copy paste the code. :D


Just paste the code below in the code window in between Sub DocxConvert and End Sub.

sPath = "D:\TempDocx\"
sFile = Dir(sPath & "*.docx")
While sFile <> ""
With Documents.Open(sPath & sFile)
.SaveAs FileName:=sPath & Replace(sFile, "docx", "doc"), FileFormat:=0
End With
sFile = Dir

And when you’re done, the code editor window should look like:


And, here we are almost done.

Goto File->Close and Return to Microsoft Word.


  1. Place all the .docx files that are to be converted to .doc into our dummy folder TempDocx.
  2. After placing all those files, Open Microsoft Word and navigate to the Developer Tab
  3. Click on Macros and then Select DocxConvert and click RUNRun_macros
  4. So, here you’ll be able to see some opening and closing of files. This signifies that the operation is a success.
  5. The new .doc files will be saved in the same dummy directory “TempDocx”. So there will be two files with the same name but different extensions.

So, here we go. We’re done with it. Though this seems a sort of lengthy since I had to start from the root and cover the beginners too.