Re: Récupérer une phrase sur un site internet |
Titre du sujet : Re: Récupérer une phrase sur un site internet par Icedarts le 05/06/2023 14:12:59 Bonjour a tous,
Sub recup() Dim IE As Object Dim IEdoc As Object, Res As Object Dim DOCelement As Object, FrameLeftDoc As Object Dim Championnat As Object, NumEquipe As Object, btnValider As Object Set IE = CreateObject("InternetExplorer.Application") IE.Visible = True IE.Navigate ("www.dl-ligue.com") WaitIE IE Set IEdoc = IE.document Set FrameLeftDoc = IEdoc.frames("leftframe").document Set DOCelement = FrameLeftDoc.All("M21") DOCelement.Click WaitIE IE Set IEdoc = IE.document Set FrameLeftDoc = IEdoc.frames("leftframe").document Set DOCelement = FrameLeftDoc.All("A9") DOCelement.Click WaitIE IE Set IEdoc = IE.document Set Championnat = IEdoc.All("A1") Championnat.Value = "2" 'Choix menu déroulant Dim Derlig& Derlig = Range("A" & Rows.Count).End(xlUp).Row For i = 1 To Derlig If Cells(i, 1) Then With DOCelement Set DOCelement = IEdoc.getElementsByName("A3").Item DOCelement.Value = Cells(i, 1).Text Set btnValider = IEdoc.All("A4") btnValider.Click WaitIE IE Application.Wait Now() + TimeValue("00:00:01") Set Res = IEdoc.All("tzA5") Debug.Print Res.innerText End With End If Next i If Cells(i, 1) <> "" Then MsgBox ("Traitement terminé !") If Cells(L + 1, 1) <> "" Then MsgBox ("Traitement terminé !") Application.Wait Now() + TimeValue("00:00:10") IE.Quit Set IE = Nothing End Sub Sub WaitIE(IE As Object) 'On boucle tant que la page n'est pas totalement chargée Do Until Not IE.Busy And IE.readyState = 4 Application.Wait Now() + TimeValue("00:00:01") DoEvents Loop End Sub
|
Forums