- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
26#
發表於 2013-11-18 17:29
| 只看該作者
回復 25# stillfish00
感謝補足說明
回復 24# c_c_lai
如果這些 出口報單放行單查詢的網頁相類似的可如此 (改一下stillfish00的程式碼)- Option Explicit
- Sub 出口查詢()
- Dim sID As String, sStatus As String, URL As String
- Dim x
- URL = InputBox("1:出口報單放行資料查詢(產證專用)(GB315)" & vbLf & "2:出口報單通關流程查詢(GB309)", "出口資料查詢", 1)
- If URL = "" Or (URL <> "1" And URL <> "2") Then Exit Sub
- URL = IIf(URL = "1", "GB315", "GB309")
- sID = InputBox("出口報單號碼", "出口報單放行資料" & URL & "查詢", "BE 02XE580024")
- If sID = "" Then Exit Sub
- URL = "http://portal.sw.nat.gov.tw/APGQ/" & URL & "?&declNo=" & sID
- With CreateObject("InternetExplorer.Application")
- .Visible = True ' 是否顯示 IE
- .Navigate URL
- Do While .readyState <> 4
- DoEvents
- Loop
- For Each x In .document.getElementsByTagName("input")
- If x.Value = "查詢" Then x.Click: Exit For
- Next
- 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
- With ActiveSheet
- .Cells.Clear
- .[A1].Select
- .PasteSpecial Format:="HTML"
- End With
- .Quit
- End With
- End Sub
複製代碼 |
|