LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Creation & Implementation of VB6 DLL in VBA to raise events

Hello All,

I'm struggling a bit and would appreciate any direction anyone might be
able to provide...

I created the following simple ActiveX DLL in VB6, registered the DLL
in windows, and included the references in the two workbooks (described
below). This code resides in "Class1" of the DLL:
__________________________________________________ __
Public Event DataRecived(Price As String, MarketIndex As Byte)

Public Sub DateRec(Price As String, MarketIndex As Byte)

RaiseEvent DataRecived(Price, MarketIndex)
MsgBox "data received by DLL: " & Price & ", " & MarketIndex

End Sub
__________________________________________________ _

I then created a workbook to send data via the DLL. I placed the
following code in Sheet1..
__________________________________________________
Public WithEvents SendData As DataEvent.Class1

Sub DataSend()

Set SendData = New DataEvent.Class1
Call SendData.DateRec("12345", 1)
Set SendData = Nothing

End Sub
_________________________________________________

and I created a second workbook to receive the data. This code was
placed in Sheet1 of this workbook:
_______________________________________________
Public WithEvents ReceiveData As DataEvent.Class1

Sub initialize()

Set ReceiveData = New DataEvent.Class1

End Sub

Sub ReceiveData_DataRecived(Price As String, MarketIndex As Byte)

MsgBox Price & ", " & MarketIndex

End Sub
_______________________________________________

After initializing the the "ReceiveData" object in the "data receiving"
workbook, when I raise the event in the "data sending" workbook by
issuing the command:
Call SendData.DateRec("12345", 1)
the DLL manages to give me the shown msgbox, indicating that it is in
fact receiving the data. Yet, the second workbook does not respond to
the:
RaiseEvent DataRecived(Price, MarketIndex)
issued by the DLL. It is as though the event never fired.

Any ideas as to why??

TIA

Trip

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel functions implementation history gecs Excel Discussion (Misc queries) 3 October 1st 09 08:25 AM
Functions implementation history gecs Excel Discussion (Misc queries) 0 August 18th 09 07:13 PM
Reposting: Drag And Drop Implementation in excel xcelion Excel Programming 0 September 24th 05 04:28 PM
Drag And Drop Implementation in excel xcelion Excel Programming 0 September 24th 05 10:02 AM
UserForm implementation Fernando Ronci Excel Programming 1 August 24th 04 02:46 PM


All times are GMT +1. The time now is 01:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"