View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
FrigidDigit[_2_] FrigidDigit[_2_] is offline
external usenet poster
 
Posts: 32
Default Chip Please help with progress reporter

Bob,

Just a question. Once my procedure starts running, the dialog box does not
have focus and trying to click on the cancel button has no effect.

What am I doing wrong? Please let me know which code snippets you need to
see to help.

Thank you very much!

FD


"Bob Phillips" wrote in message
...
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