Страницы: 1
RSS
Получить внешний iP макросом.
 
Добрый день.
Как можно ли при помощи макроса получить внешний ip в ячейку G5 ? например с сайта 2ip  
Видел что есть решения для курса валют...можно ли тоже самое сделать с ip
 
Доброго времени суток.
Мой первый практический опыт работы с сайтами.
Информация берется с указанного сайта, но почему-то не закрывается процесс.
 
Вот нашел за 3 минуты на просторах интернета...
Проверил. Все работает
Код
Option Explicit
    
'----------------------------------------------------------------------------
'This module contains 3 functions for determing the public IP, the local IP
'and the MAC address of the computer that runs those functions.

'Written By:    Christos Samaras
'Date:          22/11/2014
'E-mail:        xristos.samaras@gmail.com
'Site:          http://www.myengineeringworld.net
'----------------------------------------------------------------------------
        
Function GetMyPublicIP() As String

    Dim HttpRequest As Object
    
    On Error Resume Next
    'Create the XMLHttpRequest object.
    Set HttpRequest = CreateObject("MSXML2.XMLHTTP")

    'Check if the object was created.
    If Err.Number <> 0 Then
        'Return error message.
        GetMyPublicIP = "Could not create the XMLHttpRequest object!"
        'Release the object and exit.
        Set HttpRequest = Nothing
        Exit Function
    End If
    On Error GoTo 0
    
    'Create the request - no special parameters required.
    HttpRequest.Open "GET", "http://myip.dnsomatic.com", False
    
    'Send the request to the site.
    HttpRequest.Send
        
    'Return the result of the request (the IP string).
    GetMyPublicIP = HttpRequest.ResponseText

End Function
 
огромное спасибо
Страницы: 1
Наверх