VBA Error 462 : Remote server machine does not exist, with Ie.Navigate

tm13

New Member
Joined
May 18, 2012
Messages
4
I wrote a code from various sources around the internet that pulls data from a website with a static url with the exception of 2 fields. I had this code working at one point but my computer crashed and i lost it and had to re write it.

What the code does:

I have a list of APN Numbers and i want to paste them in the A column then it pulls land, improvements and total value for the buildings and puts them in columns b, c, and d.

Now when i do this it does the first record but then gives me a "run-time error '462': the remote server machine does not exist or is unavailable" on the ie.navigate "http://tax.ocgov.com/tcweb/detail_sec.asp?ReqParcel=" & APN & "&StreetNo=&Direction=&StreetName=&APN=" & APN & "&Suffix=00&CmpRevDte=79889283&RollTypCde=Secured&Code=A&StSuffix=&City=&Unit=&s=1&p=1&t=&TaxYr=2011" line

here is the whole code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
For i = 1 To Range("a6000").End(xlUp).Row
Dim APN As String
APN = Range("a" & i).Value

If Target.Row = Range("A1").Row And _
Target.Column = Range("A1").Column Then

Dim Ie As New InternetExplorer

Ie.Visible = False
Ie.navigate "http://tax.ocgov.com/tcweb/detail_sec.asp?ReqParcel=" & APN & "&StreetNo=&Direction=&StreetName=&APN=" & APN & "&Suffix=00&CmpRevDte=79889283&RollTypCde=Secured&Code=A&StSuffix=&City=&Unit=&s=1&p=1&t=&TaxYr=2011"
Do
DoEvents
Loop Until Ie.readyState = READYSTATE_COMPLETE
Dim doc As HTMLDocument
Set doc = Ie.document

STD = Trim(doc.getElementsByTagName("TD")(195).innerText)
STD2 = Trim(doc.getElementsByTagName("TD")(203).innerText)
STD3 = Trim(doc.getElementsByTagName("TD")(215).innerText)
Ie.Quit

Cells(i, 2).Value = STD
Cells(i, 3).Value = STD2
Cells(i, 4).Value = STD3

End If

Next i


End Sub



can anyone give me some insight on this. I am new to vba so you might have to explain it in "English" for me. Even though I got it to work at one point I still have no idea what half this code actually means.

thanks in advance.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Whoops, forgot to assign STD as string before getting the element(money values). I have now done this but I am receiving another Error. "object invoked is disconnected with clients". I feel like it has to do with the placement of my looping. because the first record works just fine. Also forgot to mention that I have defined Cell A1 as "APN". This is what I have now: </b>Private Sub Worksheet_Change(ByVal Target As Range)</b> </b> Dim i As Integer</b> </b>For i = 1 To Range("a6000").End(xlUp).Row</b> </b>Dim APN As String</b> </b>APN = Range("a" & i).Value</b> </b>If Target.Column = Range("APN").Column And _</b> </b>Target.Row = Range("APN").Row Then</b> </b>Dim Ie As New InternetExplorer</b> </b>Ie.Visible = False</b> </b>Ie.navigate "http://tax.ocgov.com/tcweb/detail_sec.asp?ReqParcel=" & APN & "&StreetNo=&Direction=&StreetName=&APN=" & APN & "&Suffix=00&CmpRevDte=79889283&RollTypCde=Secured&Code=A&StSuffix=&City=&Unit=&s=1&p=1&t=&TaxYr=2011"</b> </b>Do</b> </b>DoEvents</b> </b>Loop Until Ie.readyState = READYSTATE_COMPLETE</b> </b>Dim doc As HTMLDocument</b> </b>Set doc = Ie.document</b> </b>Dim STD As String</b> </b>STD = Trim(doc.getElementsByTagName("TD")(195).innerText)</b> </b>Dim STD2 As String</b> </b>STD2 = Trim(doc.getElementsByTagName("TD")(203).innerText)</b> </b>Dim STD3 As String</b> </b>STD3 = Trim(doc.getElementsByTagName("TD")(215).innerText)</b> </b>Ie.Quit</b> </b>Cells(i, 2).Value = STD</b> </b>Cells(i, 3).Value = STD2</b> </b>Cells(i, 4).Value = STD3</b> </b>End If</b> </b>Next i</b> </b>End Sub</b> </b>Any Ideas?</b>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,743
Messages
6,132,456
Members
449,729
Latest member
davelevnt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top