【发布时间】:2015-08-08 14:15:00
【问题描述】:
我想从包含此内容的网页中获取一些文本。我想获得带有 href="#spec_Brand" 的信息。
<td class="table_spec">
<dl>
<dt class="table_spec_title">
<a class="href_icon href_icon_help table_spec_titleimg" title="Which manufacturer is producing the product?" href="#spec_Brand">
<span>Brand</span>
</a>
<span class="table_spec_titletext">Brand</span>
</dt>
<dd class="table_spec_definition">
Producer of the product?
</dd>
</dl>
</td>
我正在尝试使用:
Set TDelementsA = HTMLdoc.getElementsByTagName("TD")
While r < TDelementsA.Length
If TDelementsA.className = "table_spec" Then
Sheet4.Range("A1").Offset(r, c).Value = TDelement.innerText
End If
但它给了我: 牌 产品的生产商?
代替
spec_Brand
有人可以帮我吗?
【问题讨论】:
-
当您实际写入工作表时,您从
Set、While和If行中的TDelementsA切换到TDelement。希望这里只是一个错字,而不是在实际代码中
标签: html excel html-parsing excel-2003 vba