1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
Sub AutomateIE()
Dim nbligne As Integer
Dim ie As InternetExplorer
Dim HTMLdoc As HTMLDocument
Dim serie As String
Dim year As Integer
Dim doc As String
Dim i As Integer
Dim mywebsite As String
'Dim wb1 As WebBrowser
nbligne = ActiveSheet.UsedRange.Rows.Count
Debug.Print nbligne
'MsgBox nbligne
Set ie = New InternetExplorer
For i = 2 To nbligne
serie = Cells(i, 1).Value
Debug.Print serie
year = Cells(i, 2).Value
Debug.Print year
doc = Cells(i, 4).Value
Debug.Print doc
mywebsite = "http://monsite?year=" & year & "&serie=" & serie & "&textfield2=" & doc & "&Submit=Rechercher"
Debug.Print mywebsite
ie.Visible = True
ie.Navigate mywebsite
Do Until ie.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop
Set HTMLdoc = ie.Document
ie.ExecWB 6, 2, 3, 0
Next i
End Sub |
Partager