使用excel VBA进行Web抓取
我正在查看下面的HTML代码链接:
<h1 class="wer wer"> <a href="http://somelink.com" rel="bookmark" title="Permanent Link to Title of this page that covers some random topic"> Short title of this page...</a> </h1>
我目前正在使用下面的代码拉出innertext(“这个网页的简称…”)
For Each ele In .document.all Select Case ele.classname Case "wer wer" RowCount = RowCount + 1 sht.Range("A" & RowCount) = ele.innertext End Select Next ele
我怎样才能修改这个代码来拉出标题(“永久链接到这个页面的标题,涵盖一些随机主题”)和href(“ http://somelink.com ”)?
任何帮助将非常感激。 谢谢。