开发者

IXMLDOMDocument remove all nodes or remove the complete content - VBA Excel

The following code works fine so far. But now I want to map the XML data separately, direct after loading. (I want to implement a progress bar...). For this reason I need in every cycle a nice clean DOMDocument. How can I get it?

Dim xmldoc As New DOMDocument
Dim xmldata As New DOMDocument
Dim map As xmlMap

Set map = sheet.xmlRelation

For Each fil In fol.Files
    If fil.name Like "*.xml" 开发者_开发百科Then
        xmldoc.Load (fil)
        sheet.transformXml xmldoc
        xmldata.documentElement.appendChild xmldoc.documentElement
    End If
Next fil

map.ImportXML xmldatadata.XML


Guessing at what you want to do: maybe you could clarify

Dim xmldoc As New DOMDocument
Dim xmldata As DOMDocument
Dim map As xmlMap

Set map = sheet.xmlRelation

For Each fil In fol.Files
     If fil.name Like "*.xml" Then
         xmldoc.Load (fil)
         sheet.transformXml xmldoc
         set xmldata = New DOMDocument
         xmldata.documentElement.appendChild xmldoc.documentElement
         map.ImportXML xmldatadata.XML 
     End If
 Next fil

Tim

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜