Recuperation Ip Publique

Admin
Administrateur du site
Messages : 99
Enregistré le : Jeu 2 Avr 2015 21:39

Recuperation Ip Publique

Messagepar Admin » Ven 10 Avr 2015 13:57

Sub Recuperation_Ip_Publique_Appliance()
Sheets("Appliances").Select
Dim result As String
Dim URL As String
Dim winHttpReq As Object
Dim i As Integer
Cells.Select
Selection.ClearContents
Range("A1").Select
Range("B2").Value = "IP Publique"
For i = 3 To 10

Set winHttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")

URL = "http://ipecho.net/plain"
winHttpReq.Open "GET", URL, False
winHttpReq.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
Select Case i
Case Is = 3
winHttpReq.setProxy 2, "W.X.Y.Z:8080", ""
Case Is = 4
winHttpReq.setProxy 2, "W.X.Y.Z:8080", ""
Case Is = 5
winHttpReq.setProxy 2, "W.X.Y.Z:8080", ""
Case Is = 6
winHttpReq.setProxy 2, "W.X.Y.Z:8080", ""
Case Is = 7
winHttpReq.setProxy 2, "W.X.Y.Z:8080", ""
Case Is = 8
winHttpReq.setProxy 2, "W.X.Y.Z:8080", ""
Case Is = 9
winHttpReq.setProxy 2, "W.X.Y.Z:8080", ""
Case Is = 10
winHttpReq.setProxy 2, "W.X.Y.Z:8080", ""
End Select
winHttpReq.send
result = winHttpReq.responseText
Range("A" & i).Value = "Appliance" & i
Range("B" & i).Value = result
Range("E" & i).Value = "A.B.C.D" & i - 2
Range("F" & i).Value = "Proxy" & i - 2
Next

Call Boucle_Repartition
End Sub

*************************************************************

Sub Boucle_Repartition)
Dim i As Integer
Dim Ligne As Long
Dim Ligne2 As Long
Sheets("Appliances").Select
Range("A1").Select
Range("F2:G2").Value = "Repartition"
i = 3
J = 3
Ligne = Range("E3").End(xlDown).Row + 1
Ligne2 = Range("B3").End(xlDown).Row
While J <> Ligne
Range("G" & i & "").Value = WorksheetFunction.CountIf(Range("B3:B" & Ligne2 & ""), Range("E" & i & "").Value)
i = i + 1
J = J + 1
Wend
Sheets("Appliances").Select
Range("A1").Select

End Sub

Qui est en ligne

Utilisateurs parcourant ce forum : Aucun utilisateur enregistré et 1 invité