五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

獲取股票實(shí)時行情數(shù)據(jù) Access數(shù)據(jù)庫系統(tǒng)功能講解VBA代碼編程實(shí)例

2022-07-03 22:01 作者:凌霄百科  | 我要投稿




Private Sub Command查詢_Click()

If Me.查詢股票代碼 <> "" Then

Dim scode As String

scode = Me.查詢股票代碼

? ? If IsNumeric(scode) = False Then

? ? MsgBox "請輸入正確股票代碼"

? ? Exit Sub

? ? End If

Else

Exit Sub

End If

Call 獲取并顯示股票數(shù)據(jù)(scode)

End Sub



Public Function getstockbasicdatafun(ByVal codetext As String) As String

? ? Dim url As String? ?'數(shù)據(jù)獲取地址

? ? If codetext <> "" Then

? ? ? ? url = "http://qt.gtimg.cn/q=" & codetext

? ? ? ? With CreateObject("msxml2.XMLHTTP")

? ? ? ? ? ? .Open "get", url, False

? ? ? ? ? ? .Send

? ? ? ? ? ?If UBound(Split(.responsetext, "~")) > 2 Then

? ? ? ? ? ? ? ?getstockbasicdatafun = .responsetext

? ? ? ? ? ?Else

? ? ? ? ? ? ? ?getstockbasicdatafun = .responsetext

? ? ? ? ? ?End If

? ? ? ? End With

? ? Else

? ? ? ? getstockbasicdatafun = "none"

? ? End If

End Function

Sub 獲取并顯示股票數(shù)據(jù)(ByVal scode As String)

On Error GoTo 錯誤清空

'-------------------------------處理代碼

If Left(scode, 1) = 6 Then

? ? scode = "sh" & scode

Else

? ? scode = "sz" & scode

End If

'-------------------------------獲取股票數(shù)據(jù)

Dim code_data As String

code_data = getstockbasicdatafun(scode)

If code_data = "none" Then

? ? MsgBox "未找到該股票"

? ? '-------------------------------清空數(shù)據(jù)

? ? Me.股票代碼 = ""

? ? Me.名稱 = ""

? ? Me.當(dāng)前價 = ""

? ? Me.漲跌 = ""

? ? Me.當(dāng)前漲幅 = ""

? ? Me.開盤價 = ""

? ? Me.最高價 = ""

? ? Me.最低價 = ""

? ? Exit Sub

End If


'-------------------------------分割處理顯示數(shù)據(jù)

Dim stockitem_array1

stockitem_array1 = Split(code_data, "~")

Me.股票代碼 = stockitem_array1(2)

Me.名稱 = stockitem_array1(1)

Me.當(dāng)前價 = stockitem_array1(3)

Me.開盤價 = stockitem_array1(5)

Me.最高價 = stockitem_array1(41)

Me.最低價 = stockitem_array1(42)

Me.漲跌 = Round(stockitem_array1(3) - stockitem_array1(5), 2)

Me.當(dāng)前漲幅 = stockitem_array1(32)

If Me.當(dāng)前漲幅 >= 0 Then

Me.當(dāng)前漲幅.ForeColor = RGB(255, 50, 50)

Else

Me.當(dāng)前漲幅.ForeColor = RGB(50, 255, 50)

End If

Exit Sub

錯誤清空:

? ? Me.股票代碼 = ""

? ? Me.名稱 = ""

? ? Me.當(dāng)前價 = ""

? ? Me.漲跌 = ""

? ? Me.當(dāng)前漲幅 = ""

? ? Me.開盤價 = ""

? ? Me.最高價 = ""

? ? Me.最低價 = ""

End Sub

Private Sub Form_Timer()

If Me.股票代碼 <> "" Then

Call 獲取并顯示股票數(shù)據(jù)(Me.股票代碼)

End If

End Sub


獲取股票實(shí)時行情數(shù)據(jù) Access數(shù)據(jù)庫系統(tǒng)功能講解VBA代碼編程實(shí)例的評論 (共 條)

分享到微博請遵守國家法律
堆龙德庆县| 保山市| 柳江县| 河北省| 新丰县| 渝中区| 凤阳县| 蒲城县| 施秉县| 深泽县| 高州市| 西乌珠穆沁旗| 界首市| 阜阳市| 柘荣县| 青田县| 吉木萨尔县| 仁怀市| 乡宁县| 夏津县| 汕头市| 洛隆县| 金坛市| 兴安县| 泸西县| 宁强县| 丰都县| 醴陵市| 揭阳市| 垦利县| 遂宁市| 隆子县| 上高县| 长宁县| 巴彦县| 怀远县| 秦安县| 安乡县| 长海县| 定边县| 呼伦贝尔市|