返回列表 上一主題 發帖

Object資料怎麼轉到Worksheet!

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指定的一樣轉到工作表中啊~

大感謝!!!
我是ausitn.

        靜思自在 : 布施如播種,以歡喜心滋潤種子,才會發芽。
返回列表 上一主題