VB codePrivate Sub SavePicture(szURL, fName) '保存图片
'网页路径,文件名
Dim x As XMLHTTP
Dim oStream As ADODB.Stream
Dim xx As String
Set x = New XMLHTTP
x.Open "GET", szURL, False
x.send
xx = app.path + "/"
Set oStream = New ADODB.Stream
oStream.Type = 1
oStream.Open
oStream.Write x.responseBody
oStream.SaveToFile xx + fName
oStream.Close
End Sub
'功能:取得网址中的所有链接名称和地址
'需要要引用 Microsoft HTML Object Library
Private Sub GetLinks()
Dim Doc As IHTMLDocument2
Dim All As IHTMLElementCollection
Dim L As Integer
Dim i As Integer
Dim Varl As Variant
Set Doc = WebBrowser1.document
Set All = Doc.images '取图片的连接 doc.links 取文字链接
L = All.length
For i = 0 To L - 1
Set Varl = All.Item(i, varempty)
List1.AddItem ("地址:" & Varl.href) 'item.innertext 取文本链接名称
Set Varl = Nothing
Next i
Set All = Nothing
Set Doc = Nothing
End Sub