VBA Event handling
-
Hello, i like to handle an event from an included libary: I use this code in my VBA project form1:
Private WithEvents mScandata As RealScan ------------------------------------------ Private Sub Form_Load() Set mScandata = New RealScan End Sub ------------------------------------------ Private Sub mScandata_ScanReady(ByVal pDobj As SCANNERLib.IDataObject) Dim i As Long For i = 0 To 250 MessageBeep (i) Next End Sub ------------------------------------------
This code doesen' t work. Does anybody has experience with event handling in vb? I think the prob is to initiate the m_Scandata event? happy coding, -mark -
Hello, i like to handle an event from an included libary: I use this code in my VBA project form1:
Private WithEvents mScandata As RealScan ------------------------------------------ Private Sub Form_Load() Set mScandata = New RealScan End Sub ------------------------------------------ Private Sub mScandata_ScanReady(ByVal pDobj As SCANNERLib.IDataObject) Dim i As Long For i = 0 To 250 MessageBeep (i) Next End Sub ------------------------------------------
This code doesen' t work. Does anybody has experience with event handling in vb? I think the prob is to initiate the m_Scandata event? happy coding, -markThe qeustion should be has anyone ever done anything with the RealScan library? And from what I can tell when searching for RealScan, that's not very likely. Handling events in VB/VBA/VB.Net is so common it happens in virtually every app everyone writes. It LOOKS like everything is OK. There are many possibilities as to why your having a problem with it. The signature of the event handler could be wrong, the documentation on the library could be wrong, the library firing the event when it's supposed to and your not looking for it at that time, or you expecting the event when the library is not supposed to fire it, or are you supposed to call an initlization function after you create the object... The list goes on and on... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome