#25 How to Parse XML Files with VBA Introduction

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 พ.ย. 2024

ความคิดเห็น • 4

  • @lovet7239
    @lovet7239 4 หลายเดือนก่อน

    Huge thanks to you! It was very useful for me. I have understood how to create XML parser i need!

  • @troyajohnson26
    @troyajohnson26 หลายเดือนก่อน

    I've modified your code to match my xml data, but when I run the code, it highlights yellow the first item in the loop. How does it know to look for my specific child nodes? My xml is much larger and has many tables associated with it, but I only need the data from one particular section.

    • @Mindful_Explorer
      @Mindful_Explorer  หลายเดือนก่อน +1

      It sounds like the code is highlighting because it's trying to loop through all child nodes, but it needs to be more specific for your larger XML. To focus on one section, you'll want to target the exact node you're interested in. Here's an example:
      Dim xmlDoc As Object
      Set xmlDoc = CreateObject("MSXML2.DOMDocument")
      xmlDoc.Load (filePath)
      ' Adjust "SectionName" to match the part of your XML you need
      Dim sectionNode As Object
      Set sectionNode = xmlDoc.SelectSingleNode("//SectionName")
      If Not sectionNode Is Nothing Then
      Dim childNode As Object
      For Each childNode In sectionNode.ChildNodes
      Debug.Print childNode.Text
      Next childNode
      Else
      MsgBox "Section not found"
      End If
      Make sure to check your XML structure to find the right node. If your XML is more complex, adjust the SelectSingleNode with the correct path.

  • @lion123145678
    @lion123145678 3 หลายเดือนก่อน

    please share me XML file in the video