請教前輩!
樓下的程式要如何改才能抓往前5個月的資料,且每個月的資料都能任意更改貼圖的位置
Sub WEBQYT()
Dim ptxt As String
Dim yy, mm, stock
Sheet1.Activate
If Sheet1.QueryTables.Count = 0 Then
Sheet1.QueryTables.Add Connection:="URL;", Destination:=Range("A1")
End If
yy = InputBox("輸入查詢「西元」年份", "上櫃股票 - 個股日成交資訊")
If yy = "" Then Exit Sub
mm = InputBox("輸入查詢月份", "上櫃股票 - 個股日成交資訊")
If mm = "" Then Exit Sub
stock = InputBox("輸入股票代碼", "上櫃股票 - 個股日成交資訊")
If stock = "" Then Exit Sub
With Sheet1.QueryTables(1)
.Connection = "URL;http://www.otc.org.tw/ch/stock/aftertrading/daily_trading_info/result_st43.php"
.PreserveFormatting = False
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebDisableDateRecognition = True
.PostText = "ajax=true&yy=" & yy & "&mm=" & mm & "&input_stock_code=" & stock
.Refresh False
End With
End Sub作者: mark15jill 時間: 2012-11-22 15:36