Hello
I am trying to use the RaiseEvents in Excel VBA to send variables from one class module to another.
Below is what I have so far.
cls1:
Event itsdone(Company As Variant, Number As String)
Run code here
'This next line gives me the variables from the procedure
Enditall mycompany, mynumber
Private Sub Enditall(Company As Variant, Number As String)
RaiseEvent itsdone(Company, Number)
cls2:
Private WithEvents oCompany As cls1
Private Sub Class_Initialize()
If oCompany Is Nothing Then Set oCompany= New cls1
Exit Sub
'This next line should then get the data from the RaiseEvent
Private Sub oCompany_itsdone(Company As Variant, Number As String)
========================
The problem is that the code runs but when gets to the RaiseEvent nothing happens it just moves on to the next line of code which is End Sub. I am expecting it to pass the variables from cls1 to the oComapny_itsdone sub in cls2.
I'd be very grateful if anyone knows a way around this and if more information is needed i can pass it on.
Thanks in advance.
I am trying to use the RaiseEvents in Excel VBA to send variables from one class module to another.
Below is what I have so far.
cls1:
Event itsdone(Company As Variant, Number As String)
Run code here
'This next line gives me the variables from the procedure
Enditall mycompany, mynumber
Private Sub Enditall(Company As Variant, Number As String)
RaiseEvent itsdone(Company, Number)
cls2:
Private WithEvents oCompany As cls1
Private Sub Class_Initialize()
If oCompany Is Nothing Then Set oCompany= New cls1
Exit Sub
'This next line should then get the data from the RaiseEvent
Private Sub oCompany_itsdone(Company As Variant, Number As String)
========================
The problem is that the code runs but when gets to the RaiseEvent nothing happens it just moves on to the next line of code which is End Sub. I am expecting it to pass the variables from cls1 to the oComapny_itsdone sub in cls2.
I'd be very grateful if anyone knows a way around this and if more information is needed i can pass it on.
Thanks in advance.