我想刮掉" data-lat"和" data-lon"值。但我不知道我怎么能做到这一点。请帮忙,谢谢......................
<div id="gmap" data-lat="40.98947720463825" data-lon="29.031221866607666"
Sub sahibinden()
Dim ie As New InternetExplorer
Dim HTMLDoc As HTMLDocument
Dim url As String
Dim x As Object
Dim y As Object
ie.Visible = True
url = "https://www.sahibinden.com/ilan/is-ilanlari-egitim-kurumsal-egitim-ve-danismanlik-evlere-yatili-yatisiz-yabanci-uyruklu-elemanlar-araniyor-459508951/detay"
ie.navigate url
Do While ie.Busy Or ie.readyState <> READYSTATE_COMPLETE
DoEvents
Loop
Set HTMLDoc = ie.document
x = HTMLDoc.getElementById("gmap").innerText
MsgBox x
End Sub
答案 0 :(得分:0)
试试这个:
Dim objGmap As Object
Dim lat As String, lon As String
Set objGmap = HTMLDoc.getElementById("gmap")
If Not objGmap Is Nothing Then
lat = objGmap.getAttribute("data-lat")
lon = objGmap.getAttribute("data-lon")
End If