Archive for the '楽天RSS' Category

[楽天RSS] AccessでDDE

AccessでDDE
Sub Test1()
Dim count As Integer: count = 0
Dim code As Integer: For code = 1300 To 3000
For Each T In Array("T", "Q", "OS", "OJ")
Dim topic As String
topic = "[Code].[T]"
topic = Replace(topic, "[Code]", CStr(code))
topic = Replace(topic, "[T]", T)

On Error Resume Next
Dim ChanNum As Long: ChanNum = Application.DDEInitiate("RSS", topic)
Dim s As String: s = Application.DDERequest(ChanNum, "銘柄名称")
If Err.Number = 0 Then
Application.DDETerminate ChanNum
count = count + 1
Debug.Print count, code, T, s
Exit For
End If
Application.DDETerminate ChanNum
DoEvents
Next
Next
End Sub

[楽天RSS] 銘柄一覧の取得(Excel)

BEAMbitious トレーディング ブログ さんで紹介されてたStockFindを試してみた。

ExcelVBAでお手軽に

Sub 銘柄一覧()
 
Dim channel As Long: channel = DDEInitiate("RSS", "StockFind")
 
Dim s As Variant: s = DDERequest(channel, "NULL")
 

 
Dim rowIndex As Integer: For rowIndex = LBound(s) To UBound(s)
 
Dim code As String: code = s(rowIndex, 1)
 
Dim 名称 As String: 名称 = s(rowIndex, 2)
 
Dim 業種 As String: 業種 = s(rowIndex, 5)
 
Dim 市場 As String: 市場 = s(rowIndex, 6)
 

 
Debug.Print 業種, 市場, code, 名称
 
Next
 

 
DDETerminate channel
 
End Sub

すばらしいですね。BEAMbitious の人に感謝。

[楽天RSS] 銘柄一覧の取得(Access)

銘柄一覧の取得 のAccess版


 
Dim channel As Long: channel = DDEInitiate("RSS", "StockFind")
 
Dim s As Variant: s = DDERequest(channel, "NULL")
 
DDETerminate channel
 

 
Dim lines() As String: lines = Split(s, vbLf)
 

 
Dim rowIndex As Integer: For rowIndex = 1 To UBound(lines)
 
Dim columns() As String: columns = Split(lines(rowIndex), vbTab)
 

 
Dim code As String: code = columns(0)
 
Dim 名称 As String: 名称 = columns(1)
 
Dim 業種 As String: 業種 = columns(4)
 
Dim 市場 As String: 市場 = columns(5)
 

 
Debug.Print 業種, 市場, code, 名称
 
Next