- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
回復 2# kim223824
'URL = "http://amis.afa.gov.tw/v-htm/v102.htm"
'********網址有改變 ******
URL = "http://amis.afa.gov.tw/v-asp/v102q.asp"
試試看- Option Explicit
- Sub 菜價2015_12_05_1()
- Dim xTable As Object, k As Integer, c As Integer, r As Integer
- 'URL = "http://amis.afa.gov.tw/v-htm/v102.htm"
- '********網址有改變 ******
- URL = "http://amis.afa.gov.tw/v-asp/v102q.asp"
-
- With CreateObject("InternetExplorer.application")
- .Visible = True
- .Navigate URL
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- With .document
- .ALL("mkno").Value = 104
- .ALL("B1").Click
- End With
- Do While .Busy Or .readyState <> 4: DoEvents: Loop
- Set xTable = .document.getelementsbytagname("TABLE") '(1)
- With Sheets("下載")
- .UsedRange.Clear
- k = 1
- For i = 0 To 1 ' For EACH E In xTable '.document.getelementsbytagname("TABLE")
- For r = 0 To xTable(i).Rows.Length - 1
- For c = 0 To xTable(i).Rows(r).Cells.Length - 1
- .Cells(k + r, c + IIf(i = 0, 1 + 1 * c, 1)) = xTable(i).Rows(r).Cells(c).innerText
- Next
- Next
- k = k + xTable(i).Rows.Length
- Next
- End With
- .Quit
- End With
- End Sub
複製代碼 |
|