|
本帖最后由 引子玄 于 2012-12-18 01:25 编辑
Sub 图片IE提取()
With CreateObject("InternetExplorer.Application")
.Visible = False
.Navigate "http://img03.taobaocdn.com/bao/uploaded/i3/T165IBXfhbXXX_gKA0_035057.jpg_310x310.jpg"
Do Until .ReadyState = 4
DoEvents
Loop
a = .Document.All.tags("body")(0).outerhtml
Call makelog(a, "C:\Documents and Settings\Administrator\桌面\本地COOKIE", "xls") '注意:红色部分是相对路径
ActiveWorkbook.FollowHyperlink Address:= _
"file:///C:/Documents%20and%20Settings/Administrator/桌面/本地COOKIE/log.xls", _
NewWindow:=False, AddHistory:=True
Windows("log.xls").Activate
ActiveSheet.Shapes("Picture 1").Select
Application.CutCopyMode = False
Selection.Copy
Windows("间接QT法.xls").Activate '注意:兰色部分是相对名称,放本代码的工作簿命名
Range("A1").Select
ActiveSheet.Paste
Windows("log.xls").Activate
Application.WindowState = xlMinimized
ActiveWindow.Close
End With
End Sub
Private Sub makelog(inputed_string, log_path, filetype)
Dim objFSO, logfile, logtext, log_folder
Set objFSO = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
Set log_folder = objFSO.CreateFolder(log_path)
If objFSO.FileExists(log_path & "\log." & filetype) = 0 Then
Set logfile = objFSO.CreateTextFile(log_path & "\log." & filetype, True, -1)
End If
Set log_folder = Nothing
Set logfile = Nothing
Set logtext = objFSO.OpenTextFile(log_path & "\log." & filetype, 2, True, -1)
logtext.Write inputed_string
logtext.Close
Set objFSO = Nothing
End Sub
|
-
评分
-
1
查看全部评分
-
|