Hi,
I hope someone here can help me out with the following problem:
I am developing my porogram in Excel using VBA as my programming enviroment.
I hava a Request Market Data button that when pressed runs the following procedure:
----------------------------------------------------------------------
' request market data
Sub RequestMarketData_Click()
Dim id As Integer
Dim Symbol As String
Dim excahnge As String
For Each Row In Selection.Rows
id = Row.Row
Symbol = UCase(Cells(id, Columns(COLUMN_SYMBOL).column).value)
exchange = UCase(Cells(id, Columns(COLUMN_EXCH).column).value)
If Cells(id, Columns(COLUMN_SYMBOL).column).value <> STR_EMPTY Then
' Register Quote
Call ojSterlingControl.m_contractInfo.RegisterQuote(Symbol, exchange)
' update status column
Cells(id, Columns(COLUMN_STATUS).column).value = STR_QRegistered
Else
MsgBox (STR_SYMANDEXCHMISSING)
' update status column
Cells(id, Columns(COLUMN_STATUS).column).value = STR_ERROR
End If
Next
ActiveCell.Offset(1, 0).Activate
End Sub
-------------------------------------------------------------------
The following is my event procedure to gather the information about the quotes:
---------------------------------------------------------------------
Private Sub m_contractInf

nSTIQuoteSnap(structQuoteSnap As SterlingLib.structSTIQuoteSnap)
Dim i As Integer
For Each Row In Selection.Rows
i = Row.Row
Cells(i - 1, Columns(COLUMN_BIDPRICE_Tickers).column).value = structQuoteSnap.fLastPrice
Next
End Sub
----------------------------------------------------------------------
When I select only one stock I get the quote data for it without any problem.
Example
*=Selected
Before calling the Request Market Data
Symbol Price
C*
F
After
Symbol Price
C* 3
F
If I select two or more stocks in the list I get the same Quote data registered for both symbols:
Example
Before Calling the Request Market Data
Symbol Price
C*
F*
After
Intermediate Result
Symbol Price
C* 3
F* 3
Final Result
Symbol Price
C* 10
F* 10
So, both symbols get registered correctly but the event prints the same quote(price) data in all the price fields for all the symbols. So what I get is the price of the last stock in the symbol printed fo all the stocks in the list.
I have tried different combinations of loops, also I tried using an array but I had no improvement.
I hope someone here can point me towards the rigth direction as I would like to be able to select a range of symbols, call my request Data market procedure, and get all the quote data at once instead of going one by one through the whole list of stocks.
-----
If I had more time this post would be shorter.