Convert Word xml to doc

Posted on 2008-11-20
Last Modified: 2012-05-05

Our MIS outputs pupil reports in Word xml files.  I want to batch convert these documents to .doc files while maintaining all the formating and layout.  I have attached two files for reference.  If possible I would like to run a script that will convert all  .xml the files in a folder into .doc.

I cannot upload .xml as the extension is not allowed so you can download the test files from


Question by:DesiMck
    LVL 76

    Accepted Solution

    You could try this Word macro
    Sub SaveXMLFileAsDOC()
        Dim strFolder As String
        Dim strFile As String
        Dim doc As Document
        strFolder = "C:\MyFolder"
        strFile = Dir$(strFolder & "\*.xml")
        Do Until strFile = ""
            Set doc = Documents.Open(strFolder & "\" & strFile)
            doc.SaveAs strFolder & "\" & Replace$(strFile, ".xml", ".doc"), wdFormatDocument
            doc.Close wdDoNotSaveChanges
            strFile = Dir$()
    End Sub

    Open in new window

    LVL 1

    Author Comment

    this almost works excpet for one part.  The graph on the first file does not show.  Instead the following appears {EMBED MSGraph.Chart8 \s}
    Pressing Alt + F9 will bring the graph up but is there a way to automatically do this.
    Thanks for your quick response,

    LVL 1

    Author Closing Comment

    Ignore my last post - thank you, this is excellent.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    You may have already been in the need to update a whole folder stucture using a script. Robocopy does it well and even provides a list of non-updated files in a log (if asked to). Generally those files that were locked by a user or a process by the …
    Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
    This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
    This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now