mardi 31 janvier 2017

Clicking on link inside a ifram containing a document VBA

I'm trying to get some data from a site in which the link I want to click on is inside a HTML document, inside an HTML document, inside a ifram.

In the picture below you will see the code displayed with chrome:

Picture of code

Here is the source code

<iframe id=midnav-frame name=midnav src="about:blank" frameborder=0>

So my problem is that i don't know how to make VBA select the links indside the HTML documents. I have done some basic interactions between VBA and HTML before and I have tried everything I know and could find. Below is my last code:

With objIE
.Visible = True
.navigate "http://ift.tt/2kQkTwB"
Do While .Busy Or _
.ReadyState  4
DoEvents
Loop

Set Aftale = .Document.getElementsByName("aftalenr")
Aftale.Item(0).Value = AftaleNummer

Set BrugerId = .Document.getElementsByName("brugernavn")
BrugerId.Item(0).Value = Bruger

Set Adgangskode = .Document.getElementsByName("password")
Adgangskode.Item(0).Value = KODE

.Document.getElementById("edit-submit").Click

Application.Wait (Now + TimeValue("0:00:5"))


.Document.getElementById("midnav-frame").contentDocument.getElementById("leftnav-frame").contentDocument.getElementById("mel3").Click

Hope that you will be able to help me.

Best regards Jacob




Aucun commentaire:

Enregistrer un commentaire