VBA getElementById with dynamic ID

后端 未结 2 879
温柔的废话
温柔的废话 2021-01-21 16:43

I\'ve been searching this whole forum, msdn and specialised tutorials and I can\'t find the answer for VBA: How can I make the getElementById work in an access VBA

相关标签:
2条回答
  • 2021-01-21 17:08
    1. Identify the closest parent tag that always contains the ID (manually, by looking at your HTML).
    2. Enumerate all descendant <div>s of that tag, testing their ID property with Like.
    0 讨论(0)
  • 2021-01-21 17:12

    Try something like this one:

    Dim ContainerDiv As HTMLDivElement, ResultDIV As HTMLDivElement
    
    Set ContainerDiv = HTMLDoc.getElementById("rowToolTipContainer")
    For Each ResultDIV In ContainerDiv.GetElementsByTagName("div")
        If ResultDIV.ID Like "resultsTooltip*Contents" Then
    
            '' What do you want to do here?
    
            Exit For
        End If
    Next
    
    0 讨论(0)
提交回复
热议问题