0
我想網頁鏈接和嵌套標籤的元素:getElement通過嵌套的標籤名稱在VBA
<a href='/cacti/graph.php?action=view&local_graph_id=279&rra_id=all'><img class='graphimage' id='graph_279' src='/cacti/graph_image.php?local_graph_id=279&rra_id=0&view_type=tree&graph_start=1482822537&graph_end=1482908937' border='0' alt='ARD-Besat-MKT450G - Bandwidth 16 Mb- ether3-Link to PTMP'></a>
這是我的源代碼的一部分。
最後,我想:
cells(1,1).value="link address : /cacti/graph.php?action=view&local_graph_id=279&rra_id=all"
cells(1,2).value="image address: /cacti/graph_image.php?local_graph_id=279&rra_id=0&view_type=tree&graph_start=1482822537&graph_end=1482908937"
cells(1,3).value="image alt: ARD-Besat-MKT450G - Bandwidth 16 Mb- ether3-Link to PTMP'
我在VBA函數爲:
Function WebPageLinks(internet, tagname As String)
Dim internetdata As HTMLDocument
Dim internetlink As Object
Dim internetinnerlink As Object
Set internetdata = internet.document
Set internetlink = internetdata.getElementsByTagName(tagname)
For Each internetinnerlink In internetlink
Sheets("Sheet1").Select
Sheets(1).Cells(linkcount, 1) = internetinnerlink.href' true
Sheets(1).Cells(linkcount, 2) = internetinnerlink.innerhtml' true
Sheets(1).Cells(linkcount, 3) =internetinnerlink.src ' error
Sheets(1).Cells(linkcount, 4) = internetinnerlink.alt' error
linkcount = linkcount + 1
Next internetinnerlink
End Function`
什麼恰恰是問題或問題? – Vegard
我不知道如何在innerhtml元素中的元素:( –
只有2行註釋錯誤,這是問題?這些行的預期結果是什麼?可以顯示您將使用的元素類型的示例源代碼這對嗎? – Vegard