#25 How to Parse XML Files with VBA Introduction

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

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

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

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

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

    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  2 หลายเดือนก่อน +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.

    • @troyajohnson26
      @troyajohnson26 11 วันที่ผ่านมา

      @@Mindful_Explorer Thanks! Still can't get the code to parse the data. my xml has much more data. It's a series of tables that include stuff like: . So trying to mirror yours is very confusing for me lol

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

    please share me XML file in the video