- 帖子
- 1
- 主題
- 1
- 精華
- 0
- 積分
- 2
- 點名
- 0
- 作業系統
- MS XP
- 軟體版本
- XP SP3
- 閱讀權限
- 10
- 性別
- 男
- 註冊時間
- 2011-4-17
- 最後登錄
- 2015-5-9
|
Object資料怎麼轉到Worksheet!
小弟用了下列的VBA去抓YAHOO的股市資料網頁
------------------------------------------------------------------------
Sub Webloading()
Dim i As Long
Dim IE As Object
Dim objElement As Object
Dim objCollection As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = False
IE.Navigate "http://tw.stock.yahoo.com/"
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
Set objCollection = IE.document.getElementsByTagName("input")
i = 0
While i < objCollection.Length
If objCollection(i).Name = "stock_id" Then
objCollection(i).Value = "2330"
Else
If objCollection(i).Type = "submit" And _
objCollection(i).Name = "xSubmit" Then
Set objElement = objCollection(i)
End If
End If
i = i + 1
Wend
objElement.Click
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
IE.Visible = True
Set objElement = Nothing
Set objCollection = Nothing
End Sub
-------------------------------------------------------------------------
想請教各位高手
如何才能把IE抓到的網頁資料中某個table
像iqy指定的一樣轉到工作表中啊~
大感謝!!! |
|