Trying to setup an event handler in Excel 2007/VBA for streaming Time and Sales, but can't get the handler to fire.
This is what I've done:
Under my spreadsheet project, I inserted a new Class1 module and put the following line:
Public WithEvents eSig As IESignal.Hooks
On the General drop-down list, I selected eSig.
On the Declarations drop-down list I selected eSig_OnTimeSalesChanged.
The following Sub was automatically dropped into the Class1 module:
Private Sub eSig_OnTimeSalesChanged(ByVal lHandle As Long) '<-- Breakpoint set on this line of code
End Sub
I set a breakpoint as indicated, above, to stop execution when/if the handler fires.
Then, in my ThisWorkbook module, I made the Reference to IESignal (Tools->References), and put the following code in the module:
Sub Test()
Dim obj As New Class1
Set obj.eSig = New IESignal.Hooks
Dim lHandle As Long
Dim entitled As Boolean
obj.eSig.SetApplication ("UserNameHere")
entitled = obj.eSig.IsEntitled
Dim tsFilter As IESignal.TimeSalesFilter
tsFilter.sSymbol = "AA"
tsFilter.bQuotes = False
tsFilter.bTrades = True
tsFilter.lNumDays = 1
tsFilter.bFilterPrice = False
tsFilter.bFilterVolume = False
tsFilter.bFilterQuoteExchanges = False
tsFilter.bFilterTradeExchanges = False
lHandle = obj.eSig.RequestTimeSales(tsFilter)
End Sub
I stepped all the way through the Test() sub using F8 and didn't get any errors. After the last line of code in Test() sub was executed, lhandle = 1, and entitled = True.
At that point, I figured the event handler would start firing but the breakpoint I set in Class1 never gets hit. Well, the event handler actually fired one time and my breakpoint was hit, but I've never been able to get it to happen again. And everytime I run Test(), my lHandle increments by one, so doubt that is helping anything. The only way I can get the handle to reset to zero is to shut down and restart eSignal.
What am I doing wrong?
Thanks,
George
This is what I've done:
Under my spreadsheet project, I inserted a new Class1 module and put the following line:
Public WithEvents eSig As IESignal.Hooks
On the General drop-down list, I selected eSig.
On the Declarations drop-down list I selected eSig_OnTimeSalesChanged.
The following Sub was automatically dropped into the Class1 module:
Private Sub eSig_OnTimeSalesChanged(ByVal lHandle As Long) '<-- Breakpoint set on this line of code
End Sub
I set a breakpoint as indicated, above, to stop execution when/if the handler fires.
Then, in my ThisWorkbook module, I made the Reference to IESignal (Tools->References), and put the following code in the module:
Sub Test()
Dim obj As New Class1
Set obj.eSig = New IESignal.Hooks
Dim lHandle As Long
Dim entitled As Boolean
obj.eSig.SetApplication ("UserNameHere")
entitled = obj.eSig.IsEntitled
Dim tsFilter As IESignal.TimeSalesFilter
tsFilter.sSymbol = "AA"
tsFilter.bQuotes = False
tsFilter.bTrades = True
tsFilter.lNumDays = 1
tsFilter.bFilterPrice = False
tsFilter.bFilterVolume = False
tsFilter.bFilterQuoteExchanges = False
tsFilter.bFilterTradeExchanges = False
lHandle = obj.eSig.RequestTimeSales(tsFilter)
End Sub
I stepped all the way through the Test() sub using F8 and didn't get any errors. After the last line of code in Test() sub was executed, lhandle = 1, and entitled = True.
At that point, I figured the event handler would start firing but the breakpoint I set in Class1 never gets hit. Well, the event handler actually fired one time and my breakpoint was hit, but I've never been able to get it to happen again. And everytime I run Test(), my lHandle increments by one, so doubt that is helping anything. The only way I can get the handle to reset to zero is to shut down and restart eSignal.
What am I doing wrong?
Thanks,
George
Comment