Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Need a macro to Identify a users IP address

Hello all.

Is there a macro command that will Identify the persons IP address (the
person who is running the macro)? And then display it in a message box
(though with the macro Im sure I could figure this part out).

thanks =)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Need a macro to Identify a users IP address

Hi havocdragon,

Are you looking for the machine's internal or external IP address? If the
former, there's probably an API call to get the internal IP address. If the
latter, then here's a function that will do what you're looking for. Keep
in mind that it relies upon an external URL (myipaddress.com), so if that
page ever changes or the site is taken down, this will not work anymore.

Public Function sGetPublicIPAddress()
Dim x As Object
Dim sResponse As String
Dim lStart As Long
Dim lEnd As Long

Set x = CreateObject("Microsoft.XMLHTTP")

With x
.Open "GET", "http://myipaddress.com"
.send
Do Until .readyState = 4
DoEvents
Loop
sResponse = .responseText
End With

Set x = Nothing

If Len(sResponse) Then
lStart = InStr(1, sResponse, "<b") + 3
lEnd = InStr(lStart, sResponse, "</b") - 1

If lEnd lStart Then sGetPublicIPAddress = _
Mid$(sResponse, lStart, lEnd - lStart + 1)
End If
End Function

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


havocdragon wrote:
Hello all.

Is there a macro command that will Identify the persons IP address
(the person who is running the macro)? And then display it in a
message box (though with the macro Im sure I could figure this part
out).

thanks =)


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Need a macro to Identify a users IP address

Actually I do need the internal one =). I am unfamilliar with API's though.
Any idea where to look on this?

"Jake Marx" wrote:

Hi havocdragon,

Are you looking for the machine's internal or external IP address? If the
former, there's probably an API call to get the internal IP address. If the
latter, then here's a function that will do what you're looking for. Keep
in mind that it relies upon an external URL (myipaddress.com), so if that
page ever changes or the site is taken down, this will not work anymore.

Public Function sGetPublicIPAddress()
Dim x As Object
Dim sResponse As String
Dim lStart As Long
Dim lEnd As Long

Set x = CreateObject("Microsoft.XMLHTTP")

With x
.Open "GET", "http://myipaddress.com"
.send
Do Until .readyState = 4
DoEvents
Loop
sResponse = .responseText
End With

Set x = Nothing

If Len(sResponse) Then
lStart = InStr(1, sResponse, "<b") + 3
lEnd = InStr(lStart, sResponse, "</b") - 1

If lEnd lStart Then sGetPublicIPAddress = _
Mid$(sResponse, lStart, lEnd - lStart + 1)
End If
End Function

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


havocdragon wrote:
Hello all.

Is there a macro command that will Identify the persons IP address
(the person who is running the macro)? And then display it in a
message box (though with the macro Im sure I could figure this part
out).

thanks =)



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Need a macro to Identify a users IP address

havocdragon wrote:
Actually I do need the internal one =). I am unfamilliar with API's
though. Any idea where to look on this?


You could try something like this:

http://www.source-code.biz/snippets/vbasic/8.htm

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro needed to identify value and delete row if value below targe Pyrotoy New Users to Excel 3 December 9th 08 11:35 PM
Identify address of cell containing specific data Peter N. Excel Discussion (Misc queries) 3 July 12th 07 06:08 PM
Need to identify active worksheet in macro MLK Excel Worksheet Functions 1 March 13th 07 04:29 PM
identify the name of the activecell not its address RogerTheDodgerTheDirtyOldSod Excel Programming 2 September 26th 04 09:53 PM
How do you identify if a worksheet is in the last position in a Macro? Natasha[_2_] Excel Programming 2 August 8th 03 03:32 AM


All times are GMT +1. The time now is 06:47 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"