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
| Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub TEST()
Application.CutCopyMode = True
injection_plage_in_OWA Range("b10:d13")
End Sub
Sub injection_plage_in_OWA(PLAGE)
PLAGE.Copy
Dim IE, URL, IEDoC, LoG, NeWMesS
Set IE = CreateObject("internetexplorer.application")
IE.Visible = True
IE.navigate "<a href="https://mail.live.com/default.aspx?rru=compose" target="_blank">https://mail.live.com/default.aspx?rru=compose</a>"
Do: DoEvents: Loop While IE.readystate <> 4 Or IE.busy = True
Set IEDoC = IE.document
Debug.Print IEDoC.Location
If InStr(IEDoC.Location, "https://login.live.com/login") > 0 Then
IEDoC.getelementbyid("i0116").Value = "monmail@hotmail.fr"
IEDoC.getelementbyid("i0118").Value = "chamaltoulon"
IEDoC.getelementbyid("idSIButton9").Click
End If
Do: DoEvents: Loop While IE.readystate <> 4 Or IE.busy = True
Application.Wait (Now + TimeValue("0:00:03"))
keybd_event &H9, 0, 0, 0 'enfoncer la touche tab
'keybd_event &H9, 0, &H2, 0 'relache la touche tab
Sleep 100
keybd_event &H9, 0, 0, 0 'enfoncer la touche
keybd_event &H9, 0, &H2, 0 'relache la touche tab
Sleep 100
keybd_event 17, 0, 0, 0
keybd_event 86, 0, 0, 0
Sleep 50
keybd_event 86, 0, &H2, 0
keybd_event 17, 0, &H2, 0
Sleep 50
' Application.CutCopyMode = False
'Application.CutCopyMode = True
Debug.Print IEDoC.Location
End Sub |
Partager