scrapping Data from web

Armaghan12

New Member
Joined
Jul 17, 2018
Messages
3
Hi,
I am newbie please help I need to extract addresses by entering lat and long on below mention website and need to extract data on text box on which it appears.

but it is giving error of object variable or with block variable not set

Please also tell me how get data from text box thanks

Code:
Public Sub newMin()
Dim ie As Object
Dim form As Variant, button As Variant


Dim aLat As String
Dim aLong As String


Set ie = CreateObject("internetexplorer.application")


aLat = "24.323"
aLong = Range("B2")






ie.Visible = True
ie.navigate ("https://www.latlong.net/Show-Latitude-Longitude.html")


While ie.readystate <> 4
DoEvents
Wend


ie.document.getelementsbyname("hU4543").Item.innertext = aLat
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Try identifying the input elements by their placeholder attribute...

Code:
Dim e As Object

For Each e In ie.document.getElementsByTagName("input")
    If e.getAttribute("placeholder") = "lat" Then
        e.innerText = aLat
    ElseIf e.getAttribute("placeholder") = "long" Then
        e.innerText = aLong
    End If
Next e

Hope this helps!
 
Upvote 0
thanks for reply domenic but when i click the button its says fields are required how shall I deal with it



Code:
For Each e In ie.document.getElementsByTagName("input")
    If e.getAttribute("placeholder") = "lat" Then
        e.innerText = aLat
    ElseIf e.getAttribute("placeholder") = "long" Then
        e.innerText = aLong
    End If
Next e


For Each e In ie.document.getElementsByTagName("button")
    If e.getAttribute("title") = "Show Lat Long converted address on Map" Then
        e(0).Click
   
    End If
Next e
 
Upvote 0
Sorry, unfortunately I don't know why you're getting that message. Hopefully some else here on the Board will be able to help.
 
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

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