返回列表 上一主題 發帖

[發問] 2014櫃買改版

我也來測試一下,的確可以work!
但是
.WebSelectionType = xlEntirePage
會抓太多不必要的資料
---------------------
Sub WEBQ()
' 興櫃個股歷史行情

    Dim ptxt As String
    Dim yy, stock
    Sheet1.Activate
    If Sheet1.QueryTables.Count = 0 Then
        Sheet1.QueryTables.Add Connection:="URL;", Destination:=Range("A1:E1")
    End If
    'yy = InputBox("輸入查詢月份", "國年/月份")
    yy = "103/02"
    If yy = "" Then Exit Sub
   
    'stock = InputBox("輸入股票代碼", "個股")
   '4990 晶美
    stock = "4990"
    If stock = "" Then Exit Sub

    With Sheet1.QueryTables(1)
        .Connection = "URL;http://www.gretai.org.tw/ch/emergingstock/single_historical/history.php"
        .PreserveFormatting = False
        .WebSelectionType = xlAllTables
        .WebFormatting = xlWebFormattingNone
        .WebDisableDateRecognition = True
        .PostText = "ajax=true&input_month=" & yy & "&input_emgstk_code=" & stock
        .Refresh BackgroundQuery:=False
    End With
'
End Sub
很抱歉,我是小學生,不能下載檔案,是個小屁孩!

TOP

一試即成 多謝太太指教
原來是JS裡面的名稱有誤
分享給有需要的同學
testQuery2.rar (18.38 KB)


接著開始學下一階段:)

TOP

回復 3# stillfish00
行家一出手,就知有沒有

懂的就知道

雖然我現在不抓了

TOP

回復 3# stillfish00

多謝秒回
不過一直開啟不了家中的 開發人員選項
只能明天再試了 再次感謝~:handshake

TOP

回復 1# pbchen

.PostText = "ajax=true&input_month=" & yy & "&input_emgstk_code=" & stock

TOP

邊想邊發 忘了附件~:)
testQuery.rar (16.7 KB)

TOP

        靜思自在 : 有智慧才能分辨善惡邪正;有謙虛才能建立美滿人生。
返回列表 上一主題