EDIT: I'm slowly getting there. I have corrected the last error, the name was not the same as liseted in the maps view and needed to CAM002_Map. Now when I run it I get The Xpath is not valid because either the Xpath syntax is incorrect or is not supported by Excel. It does turn the table into XML though, but as I need this to be an automated process to output a ot of Excel to XML I can't be cending the code. Can anyone help? It lists this part of the code as being the error in the debug.
column.ListColumns(1).XPath.SetValue map, strXPath
I've created something, placed it below, however It get a Runtime Error '9' Subscript out of range when I run it and it highlights
Set map = ActiveWorkbook.XmlMaps("CAM002Accomm")
as being the error when I debug it.
Sub CreateXMLList()
Dim map As XmlMap
Dim strXPath As String
Dim column As ListObject
' Specify the schema map to use.
Set map = ActiveWorkbook.XmlMaps("CAM002Accomm")
' Create a new list.
Set column = ActiveSheet.ListObjects.Add
' Specify the first element to map.
strXPath = "/CAM002Accomm/Row/Record_Number"
' Map the element.
column.ListColumns(1).XPath.SetValue map, strXPath
' Specify the element to map.
strXPath = "/CAM002Accomm/Row/LPI"
column.ListColumns(2).XPath.SetValue map, strXPath
' Specify the element to map.
strXPath = "/CAM002Accomm/Row/AccDate"
column.ListColumns(3).XPath.SetValue map, strXPath
' Specify the element to map.
strXPath = "/CAM002Accomm/Row/AccStatus"
column.ListColumns(4).XPath.SetValue map, strXPath
End Sub
Bookmarks