- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
回復 3# 小俠客
試試看 2003, XP, IE8 下:沒有權限的問題- Option Explicit
- Sub EX_IE按下Enter()
- Dim http As Object, i As Integer, A As Object, Result As String
- Set http = CreateObject("InternetExplorer.Application")
- With http
- .Navigate "http://www.hkexnews.hk/sdw/search/search_sdw.asp"
- '.Visible = True
- For i = 1 To 100
- Do While .readyState <> 4 Or .Busy: DoEvents: Loop
- .document.getelementbyid("ddlShareholdingDay").Value = 30
- .document.getelementbyid("ddlShareholdingMonth").Value = 11
- .document.getelementbyid("ddlShareholdingYear").Value = 2016
- .document.getelementbyid("txtStockCode").Value = Format(Cells(i, 1), "00000")
- .document.getelementbyid("btnSearch").Click
- Do While .readyState <> 4 Or .Busy:
- DoEvents
- If .Busy Then
- .document.Focus
- DoEvents
- Application.SendKeys "{ENTER}", True '**按下鍵
- End If
- Loop
- Result = ""
- Do Until InStr(Result, "pnlResult") > 0
- Result = .document.body.innerhtml
- If Len(Result) > 0 Then
- Cells(i, 2) = IIf(InStr(Result, "pnlResult") > 0, "OK", "Not Exist")
- If InStr(Result, "pnlResult") = 0 Then GoTo Next_StockCode
- End If
- Loop
- Set A = .document.getelementbyid("pnlResult")
- Do Until InStr(Result, "Remarks:") > 0
- DoEvents
- Result = A.innerhtml
- Loop
- Next_StockCode:
- Next i
- .Quit
- End With
- MsgBox "OK"
- End Sub
複製代碼 |
|