Thread: Progress Bar
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
John John is offline
external usenet poster
 
Posts: 2,069
Default Progress Bar

I was looking at a previous post to get a progress bar to work while running
a lengthy macro. Below is the post on how to incorporate the progress bar
into your code. That works fine expect for one thing. There is a cancel
button on the progress bar, and when it is pushed the rest of my code
continues running. How do I end my code if I press cancel on the progress
bar?

It would look something like this

Sub Main
Dim PB as clsProgBar
Set PB = new clsProgBar

'if your subs are being called from a userform, hide the form first using
Me.Hide
With PB

.title = "some title"
.caption1 = "Executing, this may take a while"
.caption2 = "Doing task 1"
.show
doevents

end with

Sub1 x,y,z
pb.progress = 10
pb.caption2 = "doing task 2"

Sub2 a,b,c,d
PB.progress = 20
pb.caption2 = "doing task 3"

'etc,
'and at the end

Sub10
PB.finish

'if called from a userform, show the form again, using me.show
End Sub


Again, How do I end my code if I press cancel on the progress bar?