返回列表 上一主題 發帖

[發問] 上市個股日成交資訊下載改版建議

TOP

回復 3# f3202
  1. Sub 巨集1()
  2. '
  3.     Cells.Clear
  4.     sday = 20170524
  5.     surl = "http://www.twse.com.tw/indicesReport/MI_5MINS_HIST?response=html&date=" & sday
  6.     Range("A1").Select
  7.     With ActiveSheet.QueryTables.Add(Connection:="URL;" & surl, Destination:=Range("$A$1"))
  8.         .Refresh BackgroundQuery:=False
  9.     End With
  10. End Sub
複製代碼
請選「列印 / HTML」那頁錄製

自已錄製看看,刪除不要的,這完成了

TOP

回復 4# t8899

請選「列印 / HTML」那頁錄製

自已錄製看看,刪除不要的,這完成了
  1. Sub 巨集2()
  2.     Cells.Clear

  3.     With ActiveSheet.QueryTables.Add(Connection:="URL;http://www.twse.com.tw/exchangeReport/MI_INDEX?response=html&date=20170524&type=ALLBUT0999", Destination:=Range("$A$1"))
  4.         .Refresh BackgroundQuery:=False
  5.     End With
  6. End Sub
複製代碼

TOP

回復 7# t8899

這個很基本,前面都有範例了,自己學習

TOP

回復 10# t8899
  1. Sub 巨集1()
  2. '
  3.     Cells.Clear
  4.     With ActiveSheet.QueryTables.Add(Connection:= _
  5.         "URL;http://www.twse.com.tw/exchangeReport/MI_INDEX?response=html&date=20170524&type=ALLBUT0999", Destination:=Range("$A$1"))
  6.         .WebTables = "5"
  7.         .Refresh BackgroundQuery:=False
  8.     End With
  9. End Sub
複製代碼
不是每個網頁都可以 指定表格下載,有的頁面只能全頁下載

TOP

TOP

TOP

TOP

TOP

TOP

        靜思自在 : 道德是提昇自我的明燈,不該是呵斥別人的鞭子。
返回列表 上一主題