ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel IP lookup (https://www.excelbanter.com/excel-programming/435426-excel-ip-lookup.html)

pand0ra.usa

Excel IP lookup
 
I have some code below and I can't figure out why it is broken. I am
starting at cell b3 (B is the column that has the IP addresses),
adding that to the end of a URL and retrieving the XML and outputting
it in column N. I keep getting the following error (insert whatever IP
you want):

71.129.48.10 IP NOT FOUND IN DATABASE, SORRY!

What am I doing wrong?



Sub DownloadXML()
'
' DownloadXML Macro
'

Dim xmp As XmlMap
' Select cell B3, *first line of data*.
Range("b3").Select

' Set Do loop to stop when an empty cell is reached.
Do Until IsEmpty(ActiveCell)
For Each xmp In ActiveWorkbook.XmlMaps
xmp.Delete
Next xmp
'Import Data to column M (13 = 10 + 3)
ActiveWorkbook.XmlImport URL:= _
"http://ipinfodb.com/ip_query.php?ip=" & ActiveCell.Value,
ImportMap:=Nothing, _
Overwrite:=True, Destination:=ActiveCell.Offset(0,
11).Address

' Step down 1 row from present location.
ActiveCell.Offset(1, -11).Select
Loop
End Sub

muddan madhu

Excel IP lookup
 
its running fine for me.

I am getting this results
71.129.48.10 OK US United States 6 California Los Angeles
34.0416 -118.299 -8 -8 -7


On Oct 26, 10:31*pm, "pand0ra.usa" wrote:
I have some code below and I can't figure out why it is broken. I am
starting at cell b3 (B is the column that has the IP addresses),
adding that to the end of a URL and retrieving the XML *and outputting
it in column N. I keep getting the following error (insert whatever IP
you want):

71.129.48.10 * *IP NOT FOUND IN DATABASE, SORRY!

What am I doing wrong?

Sub DownloadXML()
'
' DownloadXML Macro
'

Dim xmp As XmlMap
* * * ' Select cell B3, *first line of data*.
* * * Range("b3").Select

* * * ' Set Do loop to stop when an empty cell is reached.
* * * Do Until IsEmpty(ActiveCell)
* * * * * * For Each xmp In ActiveWorkbook.XmlMaps
* * * * * * * * xmp.Delete
* * * * * * Next xmp
* * * * *'Import Data to column M (13 = 10 + 3)
* * * * *ActiveWorkbook.XmlImport URL:= _
* * * * * * "http://ipinfodb.com/ip_query.php?ip=" & ActiveCell.Value,
ImportMap:=Nothing, _
* * * * * * Overwrite:=True, Destination:=ActiveCell.Offset(0,
11).Address

* * * * *' Step down 1 row from present location.
* * * * *ActiveCell.Offset(1, -11).Select
* * * Loop
* *End Sub



pand0ra.usa

Excel IP lookup
 
It must be something wrong with the import I am doing before I am
running the script that is causing the problem.


On Oct 26, 12:06*pm, muddan madhu wrote:
its running fine for me.

I am getting this results
71.129.48.10 * *OK * * *US * * *United States * 6 * * * California * * *Los Angeles
34.0416 -118.299 * * * *-8 * * *-8 * * *-7

On Oct 26, 10:31*pm, "pand0ra.usa" wrote:

I have some code below and I can't figure out why it is broken. I am
starting at cell b3 (B is the column that has the IP addresses),
adding that to the end of a URL and retrieving the XML *and outputting
it in column N. I keep getting the following error (insert whatever IP
you want):


71.129.48.10 * *IP NOT FOUND IN DATABASE, SORRY!


What am I doing wrong?


Sub DownloadXML()
'
' DownloadXML Macro
'


Dim xmp As XmlMap
* * * ' Select cell B3, *first line of data*.
* * * Range("b3").Select


* * * ' Set Do loop to stop when an empty cell is reached.
* * * Do Until IsEmpty(ActiveCell)
* * * * * * For Each xmp In ActiveWorkbook.XmlMaps
* * * * * * * * xmp.Delete
* * * * * * Next xmp
* * * * *'Import Data to column M (13 = 10 + 3)
* * * * *ActiveWorkbook.XmlImport URL:= _
* * * * * * "http://ipinfodb.com/ip_query.php?ip=" & ActiveCell.Value,
ImportMap:=Nothing, _
* * * * * * Overwrite:=True, Destination:=ActiveCell.Offset(0,
11).Address


* * * * *' Step down 1 row from present location.
* * * * *ActiveCell.Offset(1, -11).Select
* * * Loop
* *End Sub




All times are GMT +1. The time now is 03:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com