Sub Create_XSD()
Dim StrMyXml As String, MyMap As XmlMap
Dim StrMySchema As String
StrMyXml = "<EmployeeSales>"
StrMyXml = StrMyXml & "<Employee>"
StrMyXml = StrMyXml & "<Empid>999</Empid>"
StrMyXml = StrMyXml & "<FirstName>Text</FirstName>"
StrMyXml = StrMyXml & "<LastName>Text</LastName>"
StrMyXml = StrMyXml & "<InvoiceNumber>999</InvoiceNumber>"
StrMyXml = StrMyXml & "<InvoiceAmount>999</InvoiceAmount>"
StrMyXml = StrMyXml & "</Employee>"
StrMyXml = StrMyXml & "<Employee></Employee>"
StrMyXml = StrMyXml & "</EmployeeSales>"
Application.DisplayAlerts = False
Set MyMap = ThisWorkbook.XmlMaps.add(StrMyXml)
Application.DisplayAlerts = True
StrMySchema = ThisWorkbook.XmlMaps(1).Schemas(1).XML
Open "C:\StrMySchema.xsd" For Output As #1
Print #1, StrMySchema
Close #1
End Sub
|