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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
Option Explicit
Public Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Public Const SW_MAXIMIZE = 3
Sub recuperer_id_pdm()
Dim URL
Dim login, password As Variant
URL = "http://optibuyno.exemple.fr/"
login = Range("B1")
password = Range("B2")
telecharge URL, login, password
End Sub
Function telecharge(URL, login, password)
Dim IE As Object
Dim hi As Object
Dim iclasse As Object
Set IE = CreateObject("internetexplorer.application")
With IE
.navigate URL
.Visible = False
Do: DoEvents: Loop While .readyState <> 4 Or .busy
If .locationurl = "http://optibuyno.exemple.fr/" Then
.document.all("login").innertext = login
.document.all("passe").innertext = password
.document.all("B1").Click
End If
End With
ShowWindow IE.hwnd, SW_MAXIMIZE
Application.Wait DateAdd("s", 3, Now)
Set iclasse = IE.document.getElementsByClassName("btn_gestion")
iclasse(4).FireEvent ("onclick")
Application.Wait DateAdd("s", 7, Now)
Set hi = CreateObject("WScript.Shell")
hi.SendKeys "{Tab}"
Application.Wait DateAdd("s", 1, Now)
hi.SendKeys "{enter}"
IE.Quit
End Function |
Partager