zoukankan      html  css  js  c++  java
  • VBA运用3_股票_Module2

     1 Public Sub get_inter_info_bak(start_cow, start_clo, code, name)
     2 
     3     Dim flag_up As String
     4     
     5     flag_up = ""
     6 
     7         
     8     URL = "http://download.finance.yahoo.com/d/quotes.csv?s=" & code & "&f=sl1c1p2l"
     9 
    10     With CreateObject("msxml2.xmlhttp")
    11 
    12         .Open "GET", URL, False
    13 
    14         .send
    15 
    16         sp = Split(.responsetext, ",")
    17 
    18         If UBound(sp) > 3 Then
    19 
    20             Cells(start_cow, start_clo).Value = name
    21             
    22             Cells(start_cow, start_clo + 1).Value = sp(1)
    23 
    24             If sp(2) < 0 Then flag_up = ""
    25             Cells(start_cow, start_clo + 2).Value = flag_up & sp(2)
    26             
    27             n = Len(sp(3))
    28             Cells(start_cow, start_clo + 3).Value = Mid(sp(3), 2, n - 2)
    29 
    30         End If
    31 
    32     End With
    33 
    34 
    35     If flag_up = "" Then
    36     
    37         Worksheets("指数一覧").Cells(start_cow, start_clo).Font.Color = vbRed
    38         Worksheets("指数一覧").Cells(start_cow, start_clo + 1).Font.Color = vbRed
    39         Worksheets("指数一覧").Cells(start_cow, start_clo + 2).Font.Color = vbRed
    40         Worksheets("指数一覧").Cells(start_cow, start_clo + 3).Font.Color = vbRed
    41 
    42     Else
    43     
    44         Worksheets("指数一覧").Cells(start_cow, start_clo).Font.Color = vbGreen
    45         Worksheets("指数一覧").Cells(start_cow, start_clo + 1).Font.Color = vbGreen
    46         Worksheets("指数一覧").Cells(start_cow, start_clo + 2).Font.Color = vbGreen
    47         Worksheets("指数一覧").Cells(start_cow, start_clo + 3).Font.Color = vbGreen
    48 
    49     End If
    50 
    51 End Sub
  • 相关阅读:
    数组的练习
    java基础类和对象
    字符串的练习
    二分查找算法
    Python-charle+fiddler
    python-week1-postman+jemter-soapUI
    OBB盒的实现
    Bounding volume
    OSG动画学习
    OSG 自定义数据类型 关键帧动画
  • 原文地址:https://www.cnblogs.com/SilverBullet/p/5113690.html
Copyright © 2011-2022 走看看