前端之家收集整理的这篇文章主要介绍了
VB 读取HTML代码及网页文字,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
'得到当前browser的页面文字内容
Public Function getWebContent(browser As WebBrowser) As String
Dim doc As Object
Dim i As Object
Dim strHtml As String
Set doc = browser.Document
For Each i In doc.All
strHtml = strHtml & Chr(13) & i.innerText
Next
getWebContent = strHtml
End Function
'得到当前browser的页面Html内容
Public Function getWebHtml(browser As WebBrowser) As String
Dim doc As Object
Dim i As Object
Dim strHtml As String
Set doc = browser.Document
For Each i In doc.All
strHtml = strHtml & Chr(13) & i.innerHtml
Next
getWebHtml = strHtml
End Function