- 帖子
- 1018
- 主題
- 15
- 精華
- 0
- 積分
- 1058
- 點名
- 0
- 作業系統
- win7 32bit
- 軟體版本
- Office 2016 64-bit
- 閱讀權限
- 50
- 性別
- 男
- 來自
- 桃園
- 註冊時間
- 2012-5-9
- 最後登錄
- 2022-9-28
|
- Sub TEST11()
- Dim sID As String, sStatus As String
- Dim x
-
- sID = InputBox("出口報單號碼", "出口報單放行資料查詢", "BE 02XE580024")
- If sID = "" Then Exit Sub
-
- With CreateObject("InternetExplorer.Application")
- .Visible = True '是否顯示IE
- .Navigate "http://portal.sw.nat.gov.tw/APGQ/GB315"
- Do While .readyState <> 4: DoEvents: Loop
-
- Set x = .document.getElementById("myform").getElementsByTagName("input")
- x(0).Value = sID '填入號碼
- x(1).Click '查詢
- Do While .document.getElementById("statusMsg").Value = "": DoEvents: Loop
-
- sStatus = .document.getElementById("statusMsg").Value
- If InStr(sStatus, "[執行成功]") < 0 Then .Quit: MsgBox sStatus: Exit Sub
-
- .document.body.innerHTML = .document.getElementById("queryResult").outerHTML
- .execwb 17, 2 'Select All
- .execwb 12, 2 'Copy selection
-
- ActiveSheet.[A1].Select
- ActiveSheet.PasteSpecial Format:="HTML" ', NoHTMLFormatting:=True
- .Quit
- End With
- End Sub
複製代碼 |
|