Try:
Code:
Sub BatchConvertDocToXML()
Dim wdDoc As Document
Dim strFile As String, strFolder As String
'Initialization
strFolder = "D:\XXXX\Original\"
strFile = Dir(strFolder & "*.doc", vbNormal)
'Process each file in the file folder and convert them to xml.
While strFile <> ""
Set wdDoc = Documents.Open(FileName:=strFolder & strFile, ReadOnly:=True, AddToRecentFiles:=False, Visible:=False)
wdDoc.SaveAs2 FileName:=strFolder & Split(strFile, ".doc")(0) & ".xml", FileFormat:=wdFormatFlatXML, AddToRecentFiles:=False
wdDoc.Close False
strFile = Dir()
Wend
End Sub
PS: When posting code, please use the code tags, indicated by the # button on the posting menu. Without them, your code loses much of whatever structure it had.