• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1046
  • Last Modified:

Convert Word xml to doc

Hi,

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 http://www.deanesafl.com/TestFiles.zip

Thanks,

Desi
0
DesiMck
Asked:
DesiMck
  • 2
1 Solution
 
GrahamSkanRetiredCommented:
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$()
    Loop
End Sub

Open in new window

0
 
DesiMckAuthor Commented:
Hi,
 
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,
 
Desi

0
 
DesiMckAuthor Commented:
Ignore my last post - thank you, this is excellent.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now