- 帖子
- 21
- 主題
- 8
- 精華
- 0
- 積分
- 35
- 點名
- 0
- 作業系統
- winXP
- 軟體版本
- 1.0
- 閱讀權限
- 10
- 性別
- 男
- 註冊時間
- 2010-8-4
- 最後登錄
- 2018-3-8

|
3#
發表於 2014-5-28 01:13
| 只看該作者
Sub Purchases()
Set shts = ActiveSheet
For i = 0 To 6000 Step 50
If i = 0 Then
j = 1
Else
j = (i / 50) * 51 + 1
End If
URL = "http://www.insidermonkey.com/insider-trading/screener/#/offset=" & i & "&symbol=&price=&filing-date-from=&filing-date-to=2014-05-23&transaction=All&amount=&title-director=false&title-officer=false&title-large-shareholder=false&title-other=false&min-transaction-amount=1000000&number-of-min-insiders="
With CreateObject("InternetExplorer.Application")
.Visible = False ' 是否顯示 IE
.Navigate URL
Do While .ReadyState <> 4 Or .Busy
DoEvents
Loop
Do While .ReadyState <> 4 Or .Busy
DoEvents
Loop
xlHtm = .Document.body.innerHTML '儲存
Set A = .Document.getElementsBytagname("table")
.Document.body.innerHTML = A(0).outerHTML
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 他三不五時會停在這行
說找不到定義的物件? 不過我過段時間再按F5就又會跑了
請問這個怎麼改進
.ExecWB 17, 2 ' Select All
.ExecWB 12, 2 ' Copy selection
With shts
.Cells(j, 1).Select
.PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NoHTMLFormatting:=True
End With
.Document.body.innerHTML = xlHtm '還原
shts.Cells.EntireColumn.AutoFit ' 自動調整欄寬
.Quit
End With
Next i
End Sub |
|