[英]Data Types with XML Nodes in VBA Excel
I am using createTextNode to create string nodes for a macro that exports excel data to an XML. 我正在使用createTextNode为将Excel数据导出到XML的宏创建字符串节点。 How do I create Nodes of other Data Types? 如何创建其他数据类型的节点? When I use this on numbers it add a 1 after all my numbers.eg. 当我在数字上使用它时,它会在所有数字之后添加1。 If I put amount 50 in snip below the xml outputs 501. 如果我在xml输出501以下的片段中放入金额50。
Below is a sample of what I have: (I would like Amount to be Data Type double). 下面是我所拥有的一个示例:(我希望Amount为Data Type的两倍)。
Do While .Cells(Data_Row, 4).Value <> ""
Set oProcessI = oXMLDoc.createNode(1, "ProcessInput", "")
oFor.appendChild oProcessI
Set oIng = oXMLDoc.createNode(1, "Ingredient", "")
oIng.appendChild oXMLDoc.createTextNode(.Cells(Data_Row, 4).Value)
oProcessI.appendChild oIng
Set oAmount = oXMLDoc.createNode(1, "Amount", "")
oAmount.appendChild oXMLDoc.createTextNode(.Cells(Data_Row, 5).Value)
oProcessI.appendChild oAmount
Set oUOM = oXMLDoc.createNode(1, "UOM", "")
oUOM.appendChild oXMLDoc.createTextNode(.Cells(Data_Row, 6).Value)
oProcessI.appendChild oUOM
Set oSeq = oXMLDoc.createNode(1, "SeqNumber", "")
oAmount.appendChild oXMLDoc.createTextNode("1")
oProcessI.appendChild oSeq
Data_Row = Data_Row + 1
Loop
Additionally is there one for a date data type? 另外,是否有一个日期数据类型?
Thanks! 谢谢!
Set oSeq = oXMLDoc.createNode(1, "SeqNumber", "")
oAmount.appendChild oXMLDoc.createTextNode("1")
oProcessI.appendChild oSeq
should probably be 应该是
Set oSeq = oXMLDoc.createNode(1, "SeqNumber", "")
oSeq.appendChild oXMLDoc.createTextNode("1")
oProcessI.appendChild oSeq
You're adding the text node to the wrong element 您正在将文本节点添加到错误的元素
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.