View Full Version : Solved: Showing IP Address
slamet Harto
07-24-2008, 08:17 PM
Hi Guys,
Can you advise me on how to detect user IP address.
If it is possible thru vba, please send me a sample code.
Many thanks in advance.
Rgds, Harto
CCkfm2000
07-24-2008, 11:04 PM
check this link out http://puremis.net/excel/code/079.shtml
Bob Phillips
07-25-2008, 02:55 AM
This shorter version works for me
Set IPConfigSet = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _
("select IPAddress from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each IPConfig In IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i = LBound(IPConfig.IPAddress) To UBound(IPConfig.IPAddress)
Debug.Print IPConfig.IPAddress(i)
Next
End If
Next
slamet Harto
07-25-2008, 04:58 AM
Dear All,
Thanks a lot. That's work fine.
unbelievable, bob! you are a master.
Best,
Harto
Dragonlancer
07-29-2008, 01:06 PM
This shorter version works for me
Set IPConfigSet = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery _
("select IPAddress from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each IPConfig In IPConfigSet
If Not IsNull(IPConfig.IPAddress) Then
For i = LBound(IPConfig.IPAddress) To UBound(IPConfig.IPAddress)
Debug.Print IPConfig.IPAddress(i)
Next
End If
Next
What reference in VBA should we use for this to work?
Sincerely,
DragonLancer
Oorang
07-29-2008, 08:09 PM
/me gives bob stars
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.