Click to See Complete Forum and Search --> : Excel97 VBA - Have trouble implementing an Event sink


Tom Lee
December 13th, 1999, 12:51 PM
I have created an excel VBA app that receives event updates from an ATL inprocess server. My application receives the first event from the ATL server and writes data to a spread sheet cell. That works fine. However when a second event is fired from my ATL server, the second time I try to write to a cell, my excel application hangs. I have implemented my ATL sink for VBA exactly how the knowlege base told me. I can even use debug.print, and I am able to receive all events. I even implemented this application in VB 5.0, instead of VBA, and when I write to a text box it works fine. Does anybody know whats going on? It seems as though events from ATL are not functioning properly. It seems as though writing to an excel "CELL" seems to be a problem. My event sub is listed below.

Private Sub obj_Quote(ByVal bstrMarketCenter As String, ByVal fltBidPrice As Single, ByVal ulBidNumRoundLots As Long, ByVal fltAskPrice As Single, ByVal ulOfferNumRoundLots As Long, ByVal bstrQuoteCondition As String, ByVal bIsPrimaryMarket As Long)

On Error GoTo ExcelHosed

Debug.Print sheetName & " Row " & row
Debug.Print fltBidPrice
With Worksheets(sheetName).Cells(row, 5) ' this is where it hangs
.Value = fltBidPrice
Debug.Print "value " & .Value
End With
Debug.Print "After access"
'MsgBox "da" <<< WORKS FINE
Exit Sub

ExcelHosed:
MsgBox Error(Err)
End Sub


One last thing. I created another test ATL object that was pretty simple and it exhibits the same problem.