View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default ActiveX dll with progress feedback to Excel .xla

Forgot to say that I run MatchupArray in a Sub in normal code module.

RBS


"RB Smissaert" wrote in message
...
OK, I have got a bit further with this and this is what I got now:

In VB6:

A project VBMatchup
A class module called MatchupArray (MatchupArray.cls)
At the top of the class module code: Public Event CounterTick()
A Function in the class module called Function CompareArrayDates.
This will compare the dates in 2 arrays and return True if successfull.
In a loop in this function:
RaiseEvent CounterTick
The class has the instancing GlobalMultiUse.


In Excel:

At the declaration part of a Userform module:
Public WithEvents VBM As VBMatchup.MatchupArray
An event procedure in this same Userform module:

Public Sub VBM_CounterTick()
MsgBox "test"
End Sub

It compiles and runs, but no messagebox "test"
I have tried with adding:
Set VBM = New VBMatchup.MatchupArray
in the Sub UserForm_Initialize()
but that made no difference.

Is the trouble the GlobalMultiUse instancing in the VB6 class?
Any suggestions where I might be going wrong?


RBS


"Chip Pearson" wrote in message
...
Can you change the code in the VB6 ActiveX DLL? If not, there isn't much
you can do. If you can change the code, you could have it raise an event
every iteration of the loop, and trap the event in your userform class
module.

In the VB6 code, declare an event like

Public Event CounterTick()

then in the loop, raise the event with code like

RaiseEvent CounterTick

In your VBA Userform code module, declare your ActiveX DLL with the
WithEvents keyword:

Public WithEvents Obj As Proj.Object

and use an event procedure to update the progress bar:

Public Sub Obj_CounterTick()
' update progress indicator
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com







"RB Smissaert" wrote in message
...
I have a simple VB6 ActiveX dll that runs a loop, comparing dates in an
array.
This dll is called by an Excel .xla add-in.
Now I would like to show the progress of this dll in a userform's
progressbar in the .xla add-in.
What would be the best way to do this?

RBS