Hi,
I have a range on a single column consisting of 0s and 1s that I want to package and export automatically to an XML file on my PC.
Unfortunately Excel seems to have some problems parsing XML so I was wondering if anybody can help me out with this.
I am a pretty new to both VBA and XML so I tried to construct taking bits and pieces from books and forums
The XML Schema looking like this:
<?XML version=”1. 0” ?>
<XSD: schema xmlns: XSD=” http: //www. w3. org/2 001/XMLSchema”>
<XSD: element name=”Activation” type=” XSD:Boolean”
minOccurs=”0” maxOccurs=”500” />
</XSD: schema>
Then in the VBA Workbook:
Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
Dim xmp As XmlMap
Set xmp = _
Application.Workbooks(1).XmlMaps.Add("C:\Documents and Settings\lvonprel\Desktop\x- Files\XML Uploads\XMLSchemeControl3.xsd")
xmp.Name = "c_dr_pre_control"
Dim cll As Range
Dim xp As XPath
Set xp = Worksheets("c_dr_pre").Range("B4:B202").XPath
xp.SetValue ActiveWorkbook.XmlMaps(1), "/Activation"
MsgBox cll.XPath.Value
xp.SetValue xmp, "/ns1:Activation"
ActiveWorkbook.XmlMaps("c_dr_pre_control").Export URL:="C:\Documents and Settings\lvonprel\Desktop\x- Files\XML Uploads", _
Overwrite:=True
End Sub
Does anybody have a better code to run this kind of eventdriven function?
Thanks in advance,
Best
I have a range on a single column consisting of 0s and 1s that I want to package and export automatically to an XML file on my PC.
Unfortunately Excel seems to have some problems parsing XML so I was wondering if anybody can help me out with this.
I am a pretty new to both VBA and XML so I tried to construct taking bits and pieces from books and forums
The XML Schema looking like this:
<?XML version=”1. 0” ?>
<XSD: schema xmlns: XSD=” http: //www. w3. org/2 001/XMLSchema”>
<XSD: element name=”Activation” type=” XSD:Boolean”
minOccurs=”0” maxOccurs=”500” />
</XSD: schema>
Then in the VBA Workbook:
Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
Dim xmp As XmlMap
Set xmp = _
Application.Workbooks(1).XmlMaps.Add("C:\Documents and Settings\lvonprel\Desktop\x- Files\XML Uploads\XMLSchemeControl3.xsd")
xmp.Name = "c_dr_pre_control"
Dim cll As Range
Dim xp As XPath
Set xp = Worksheets("c_dr_pre").Range("B4:B202").XPath
xp.SetValue ActiveWorkbook.XmlMaps(1), "/Activation"
MsgBox cll.XPath.Value
xp.SetValue xmp, "/ns1:Activation"
ActiveWorkbook.XmlMaps("c_dr_pre_control").Export URL:="C:\Documents and Settings\lvonprel\Desktop\x- Files\XML Uploads", _
Overwrite:=True
End Sub
Does anybody have a better code to run this kind of eventdriven function?
Thanks in advance,
Best