Sub ImportXMLData()
Dim xlImportResult As XlXmlImportResult
xlImportResult = ThisWorkbook.XmlMaps("Invoice_Map").Import("C:\invoice.xml", True)
Select Case xlImportResult
Case xlXmlImportElementsTruncated
Debug.Print "XML data items imported with truncation."
Case xlXmlImportSuccess
Debug.Print "XML data items imported successfully."
Case xlXmlImportValidationFailed
Debug.Print "XML data items not imported. Validation failed."
Case Else
Debug.Print "Data import process reported an unknown result code."
End Select
Set xlImportResult = Nothing
End Sub
|