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
| ' Menu Outils, Références : cocher Microsoft XML, v3.0
Private Declare Function InternetCheckConnectionA Lib "Wininet" (ByVal SITE$, ByVal one&, _
ByVal zero&) As Boolean
Function WebOK(Optional ByVal URL$ = "http://www.msn.com") As Boolean
P& = InStr(9, URL, "/"): If P Then URL = Left$(URL, P)
WebOK = InternetCheckConnectionA(URL, 1, 0)
End Function
Sub Demo()
Dim Hlk As Hyperlink, oXhttp As New MSXML2.XMLHTTP
With Feuil1
If WebOK(.Hyperlinks(1).Address) = False Then Beep: Exit Sub
ReDim DT(1 To .UsedRange.Rows.Count, 1 To 1)
For Each Hlk In .Hyperlinks
With oXhttp
.Open "POST", Hlk.Address, False
.Send
If .Status = 200 Then
T$ = .responseText
P& = InStr(T, "End of placement</td><td>")
If P Then
T = Mid$(T, P + 25, 10)
If IsDate(T) Then DT(Hlk.Parent.Row, 1) = T
End If
End If
End With
DoEvents
Next
Set oXhttp = Nothing
.[E1].Resize(UBound(DT)) = DT
Beep
End With
End Sub |
Partager