View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Chip Please help with progress reporter

FD,

As far as I can see, you don't need to do anything. The DLL handles cancels
quite nicely itself, all you need to do is to click the button.

If you mean that you want to interrupt the Cancel event and do some of your
own processing, then you need to create a class to catch the events. The
class code would look something like this

Option Explicit

Public WithEvents PB As ProgressReporter.Progressor

Public Sub PB_UserCancel(Cancel As Boolean)
MsgBox "Interrupted"
End Sub


and using Chip's example you would invoke it like this, assuming the class
module is named clsEventSink,

Option Explicit

Dim Prog As ProgressReporter.Progressor
Dim cPB As clsEventSink

Sub Test()
Dim N As Long

Set Prog = New ProgressReporter.Progressor
Set cPB = New clsEventSink
Set cPB.PB = Prog
With Prog
.MinimumValue = 0
.MaximumValue = 10000
.SetParentWindow 0
.CurrentValue = 0
.Show
For N = 1 To 10000
'
' your code here
'
DoEvents
.Increment 1
Next N
End With

Set cPB = Nothing
Set Prog = Nothing

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"FrigidDigit" wrote in message
...
Hi Chip,

I am using your progress reporter dll and it works very nicely.
Unfortunately, I am too stupid to write the code to enable the user to
cancel the loop by clicking on the dialog's cancel button. Can you give me
some guidance please?

FD