Vote count:
0
i'm new to objects, i've got all of this working except the htm.getelementsbyid when i get to the rows.length i get the error run-time error 91, with object variable not set
Sub get_correct_address()
Dim x As Long, y As Long
Dim htm As Object
Set htm = CreateObject("htmlFile")
row = 6
StrNumCol = 4
StrNamCol = 5
StrTypCol = 6
CityCol = 7
ZipCol = 3
StateCol = 8
With CreateObject("msxml2.xmlhttp")
.Open "GET", "http://ift.tt/1AbtzT6 <AddressValidateRequest%20USERID=""968APPRA1046"">" & _
"<Address>" & _
"<Address1></Address1>" & _
"<Address2>" & CStr(Sheets("import").Cells(row, StrNumCol).value) + " " + Sheets("import").Cells(row, StrNamCol).value + " " + Sheets("import").Cells(row, StrTypCol).value & "</Address2>" & _
"<City>" & CStr(Sheets("import").Cells(row, CityCol).value) & "</City>" & _
"<State>" & CStr(Sheets("import").Cells(row, StateCol).value) & "</State>" & _
"<Zip5></Zip5>" & _
"<Zip4>" & CStr(Sheets("import").Cells(row, ZipCol).value) & "</Zip4>" & _
"</Address>" & _
"</AddressValidateRequest>" & _
""", False"
.send
htm.body.innerhtml = .responsetext
End With
With htm.getelementbyid("comps-results")
For x = 0 To .Rows.length - 1
For y = 0 To .Rows(x).Cells.length - 1
Sheets(1).Cells(x + 1, y + 1).value = .Rows(x).Cells(y).innertext
Next y
Next x
End With
End Sub
asked 1 min ago
excel vba getelementsbyid can't get it to work
Aucun commentaire:
Enregistrer un commentaire