Danean
asked on
Run time error XML Parse Error
I get a run time error '-2147217376 (80041020)': XML Parse Error when I run the code the below. Does anyone know the fix for this?
Sub Create_XSD()
Dim StrMyXml As String, MyMap As XmlMap
Dim StrMySchema As String
StrMyXml = "< BookInfo >"
StrMyXml = StrMyXml & "<Book>"
StrMyXml = StrMyXml & "<ISBN>Text</ISBN>"
StrMyXml = StrMyXml & "<Title>Text</Title>"
StrMyXml = StrMyXml & "<Author>Text</Author>"
StrMyXml = StrMyXml & "<Quantity>999</Quantity>"
StrMyXml = StrMyXml & "</Book>"
StrMyXml = StrMyXml & "<Book></Book>"
StrMyXml = StrMyXml & "</ BookInfo >"
' Turn off async loading.
Application.DisplayAlerts = False
' Add the string to the XmlMaps collection.
Set MyMap = ThisWorkbook.XmlMaps.add(S trMyXml)
Application.DisplayAlerts = True
' Create an empty file and output the schema.
StrMySchema = ThisWorkbook.XmlMaps(1).Sc hemas(1).X ML
Open "C:\MySchema.xsd" For Output As #1
Print #1, StrMySchema
Close #1
End Sub
Sub Create_XSD()
Dim StrMyXml As String, MyMap As XmlMap
Dim StrMySchema As String
StrMyXml = "< BookInfo >"
StrMyXml = StrMyXml & "<Book>"
StrMyXml = StrMyXml & "<ISBN>Text</ISBN>"
StrMyXml = StrMyXml & "<Title>Text</Title>"
StrMyXml = StrMyXml & "<Author>Text</Author>"
StrMyXml = StrMyXml & "<Quantity>999</Quantity>"
StrMyXml = StrMyXml & "</Book>"
StrMyXml = StrMyXml & "<Book></Book>"
StrMyXml = StrMyXml & "</ BookInfo >"
' Turn off async loading.
Application.DisplayAlerts = False
' Add the string to the XmlMaps collection.
Set MyMap = ThisWorkbook.XmlMaps.add(S
Application.DisplayAlerts = True
' Create an empty file and output the schema.
StrMySchema = ThisWorkbook.XmlMaps(1).Sc
Open "C:\MySchema.xsd" For Output As #1
Print #1, StrMySchema
Close #1
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Set MyMap = ThisWorkbook.XmlMaps.add(S