VBA getElementById with dynamic ID

筅森魡賤 提交于 2019-12-02 02:17:26

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
  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.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!