分享小編每日收集的00632R跟VIX的資料:
VBA發想:
1.透過MSXML2.XMLHTTP,GET方法將資料自動化擷取回來。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'COPYRIGHT BY dropit.liu. | |
With CreateObject("MSXML2.XMLHTTP") | |
.Open "get", A, flase '開啟網頁 | |
.send | |
Do Until .readyState = 4 '確認網頁狀態 | |
DoEvents | |
Application.Wait DateAdd("s", 0.3, Now) '等待時間 | |
If temp_time = "" Then | |
temp_time = Now() | |
Else | |
TIME_BETWEEN = DateDiff("s", temp_time, Now()) '計算花費時間 | |
If temp > 1 Then | |
checklink = 0 | |
'MsgBox "check = 0" | |
Exit Function '包在FUNCTION 中時用EXIT FUNCTION 若是改包成在SUB中則改為EXIT SUB | |
End If | |
End If | |
Loop | |
M_DATA = .responseText '取得資料站存在M_DATA中 | |
M1 = .responseBody '測試用:回傳不同的結構 | |
lValue = .Status '測試用:收集狀態 | |
lValue_2 = .readyState '測試用:收集狀態 | |
If M_DATA = "" Then | |
GoTo LINE1 '沒回傳資料的處理 | |
End If | |
End With |
2.整理資料
3.繪製成圖
4.檢查日期是否為最新,若否持續執行直到最新日期。
沒有留言:
張貼留言