VBA - Interneexplorer Object (Frame)

Asked

Viewed 1,393 times

2

I need to access a TAG(a) that is inside an Iframe that is loaded in the same page after a Submit.

See how strange:

  • When I load the object in the VBA code, I see the Iframe that I need, but the HTML that is inside Iframe is not loaded in the VBA code object.
  • It is possible to perform a forced update to the Object (Htmliframe) load all the html that appears on the page after Submit?

Someone’s been through this trouble?

See the code:

IE.Navigate "https://xxx.xxx"
WaitIE IE
IE.Document.all("ComponentID").innerText = "gem"
Set IEDoc = IE.Document
IE.Document.all("search").form.all("search").Click
WaitIE IE
Set IEDoc = IE.Document


Set profileFrame = IEDoc.getElementById("getPathBuffer") ' getPathBuffer = Nome do Iframe
Set objCollection = profileFrame.getElementsByTagName("a") 'TAG onde está o link que preciso clicar
i = 0
While i < objCollection.Length
    If objCollection(i).Name <> "" Then
        MsgBox objCollection(i).Name
    End If
    i = i + 1
Wend

Imagem VBA

HTML

1 answer

1

change:

Set profileFrame = IEDoc.getElementById("getPathBuffer") ' getPathBuffer = Nome do Iframe
Set objCollection = profileFrame.getElementsByTagName("a") 'TAG onde está o link que preciso clicar

for:

Set objCollection = ie.Document.frames(0).Document.getElementsByTagName("a") 'o indice numerico é a posição do seu frame**

if I was helpful, vote for the answer :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.