- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
6#
發表於 2014-8-5 06:27
| 只看該作者
回復 5# ciboybj
試試看- Option Explicit
- Sub Ex()
- Dim D As Object, e As Object, URL As String
- '工業用酵素
- '工業用牛奶發酵劑
- '液晶
- '防腐劑
- '工業用除臭劑
- '工業用乾燥劑
- '中和劑
- URL = "http://tmsearch.tipo.gov.tw/TIPO_DR/GoodsIPOContent.jsp"
- With CreateObject("InternetExplorer.Application")
- .Navigate URL
- .Visible = True
- Do While .ReadyState <> 4 Or .Busy
- DoEvents
- Loop
- Set D = .document.all(6).all(0).contentWindow.frames.document.getElementsByTagName("INPUT")
- D("txtGoodsName").Value = "中和劑"
- For Each e In D
- If e.Value = "查詢" Then e.Click: Exit For
- Next
- Do While .ReadyState <> 4 Or .Busy
- DoEvents
- Loop
- Set D = .document.LastChild.LastChild.all(1).contentWindow.frames.document.getElementsByTagName("table")
- Ep D(0).outerHTML
- .Quit
- End With
- End Sub
- Private Sub Ep(S As String)
- With CreateObject("InternetExplorer.Application")
- .Navigate "about:Tabs"
- .Visible = True
- .document.body.innerhtml = S
- .ExecWB 17, 2 ' Select All
- .ExecWB 12, 2 ' Copy selection
- With ActiveSheet
- .Cells.Clear
- .Range("A1").Select
- .PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NoHTMLFormatting:=True
- End With
- .Quit
- End With
- End Sub
複製代碼 |
|