返回列表 上一主題 發帖

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

http://www.twse.com.tw/ch/trading/exchange/MI_INDEX/MI_INDEX.php
如何用巨集一次下載到工作表 ??
全部(不含權證, 牛熊證.........)

TOP

本帖最後由 t8899 於 2017-5-24 18:29 編輯
回復  t8899

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

自已錄製看看,刪除不要的,這完成了
joey0415 發表於 2017-5-24 17:36

請教一下
這樣抓下來有4個表,我只要最後一個  ==> 106年05月24日每日收盤行情(全部(不含權證、牛熊證))

    With ActiveSheet.QueryTables.Add(Connection:="URL;http://www.twse.com.tw/exchangeR ... onse=html&date=20170524&type=ALLBUT0999", Destination:=Range("$A$1"))
        .Refresh BackgroundQuery:=False
    End With
日期如何用變數代入(今天) ???

TOP

回復  t8899

這個很基本,前面都有範例了,自己學習
joey0415 發表於 2017-5-24 19:22


用 Format(Date, "yyyyMMDD") ,語法問題,無法直接代入?

TOP

本帖最後由 t8899 於 2017-5-24 20:03 編輯
回復  t8899

這個很基本,前面都有範例了,自己學習
joey0415 發表於 2017-5-24 19:22

OK了,  不過,只下載最後一個表格不會
Sub Macro1()
    Cells.Clear

ddd = "URL;http://www.twse.com.tw/exchangeR ... onse=html&date=" & Format(Date, "yyyyMMDD") & "&type=ALLBUT0999"


    With ActiveSheet.QueryTables.Add(Connection:=ddd, Destination:=Range("$A$1"))
        .Refresh BackgroundQuery:=False
    End Wit


end sub

TOP

回復  t8899 不是每個網頁都可以 指定表格下載,有的頁面只能全頁下載
joey0415 發表於 2017-5-24 20:28


請教這個怎麼抓呢?
http://www.twse.com.tw/zh/page/trading/fund/T86.html

TOP

網址有了

自己練習看看
joey0415 發表於 2017-5-24 21:35


Sub Macro1()
Cells.Clear
ddd = "URL;http://www.twse.com.tw/fund/T86?response=html&date=" & Format(Date, "yyyyMMDD") & "&selectType=ALL"
With ActiveSheet.QueryTables.Add(Connection:=ddd, Destination:=Range("$A$1"))
.Refresh BackgroundQuery:=False
End With
End Sub

TOP

網址有了

自己練習看看
joey0415 發表於 2017-5-24 21:35

請教一下,字型跟大小如何控制??

TOP

回復  prin.huang

網址有了

自己練習
joey0415 發表於 2017-5-24 21:38


請教下面這個網址這麼抓?
http://www.tse.com.tw/zh/page/trading/fund/BFI82U.html

TOP

回復  t8899


自己練習看看
joey0415 發表於 2017-6-3 20:50

感謝指導

TOP

回復  t8899
自己練習看看
joey0415 發表於 2017-6-3 20:50


再請教一下面這個
http://www.twse.com.tw/zh/page/trading/exchange/TWT48U.html
  (按照除權除息日期由小到大排序)

TOP

        靜思自在 : 有多少力量就做多少事,不要心存等待,等待才會落空。
返回列表 上一主題