I just finished implementing and testing my first progress bar. I got the
code from this link:

word.mvps.org/faqs/Userforms/CreateAProgressBar.htm

I was dissappointed though!! As far as I understand how the progress bar
works and based on my timing results, the progress bar does not track actual
progress, it simply fills up a bar independently of the actual progress of a
subroutine. In the end, you get a slower program that does nothing to keep
the user informed of the actual progress.

Is there a way to code a real progress bar, one that actually tracks the
actual progress of a subroutine? Even if it does it with an error margin?

Thank you,

Juan

RE: Progress bar that tracks actual progress?? by stevencraigmiller(at)comcast(dot)net>

stevencraigmiller(at)comcast(dot)net>
Fri Jul 11 07:12:18 PDT 2008

To: Juan,

Is there a reason why you don't want to use the Status bar?

I often use something like:
For i = 1 to nNumber
Application.StatusBar = nNumber & ":" & i
'Other stuff here
Next i

Then the status bar will tell me how many items needs to be processed and
how close it is to getting done.

One drawback I've encounted when using this is that if I switch windows
during this process and then switch back, the status bar does not work.
Perhaps that is the reason you've opted for the progress bar?

Steven Craig Miller

"JuanManuel" wrote:

> I just finished implementing and testing my first progress bar. I got the
> code from this link:
>
> word.mvps.org/faqs/Userforms/CreateAProgressBar.htm
>
> I was dissappointed though!! As far as I understand how the progress bar
> works and based on my timing results, the progress bar does not track actual
> progress, it simply fills up a bar independently of the actual progress of a
> subroutine. In the end, you get a slower program that does nothing to keep
> the user informed of the actual progress.
>
> Is there a way to code a real progress bar, one that actually tracks the
> actual progress of a subroutine? Even if it does it with an error margin?
>
> Thank you,
>
> Juan
>
>

Re: Progress bar that tracks actual progress?? by Jonathan

Jonathan
Fri Jul 11 07:56:20 PDT 2008


"JuanManuel" <JuanManuel@discussions.microsoft.com> wrote in message
news:9E1B22D5-AEA7-40D8-850F-EE103EFDBFC2@microsoft.com...
>I just finished implementing and testing my first progress bar. I got the
> code from this link:
>
> word.mvps.org/faqs/Userforms/CreateAProgressBar.htm
>
> I was dissappointed though!! As far as I understand how the progress bar
> works and based on my timing results, the progress bar does not track
> actual
> progress, it simply fills up a bar independently of the actual progress of
> a
> subroutine. In the end, you get a slower program that does nothing to keep
> the user informed of the actual progress.
>
> Is there a way to code a real progress bar, one that actually tracks the
> actual progress of a subroutine? Even if it does it with an error margin?
>
> Thank you,
>


Well, you have to define how to measure that progress. The following code in
the article is purely for demonstration purposes, and you have to replace it
with your own which not only performs the actions you need but also provides
a measure of the progress in doing so

For i = 1 To 10000

' Create 10000 dummy paragraphs in ActiveDocument
ActiveDocument.Paragraphs.Last.Range. _
Text = "Test Paragraph " & i & vbCr

' Increase size of Label1 incrementally
Label1.Width = i / 50

' Repaint allows Label1 to display as it is enlarging
Frame1.Repaint

Next i


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup



Re: Progress bar that tracks actual progress?? by leightonwalter

leightonwalter
Tue Jul 15 11:17:01 PDT 2008

Thanks for the additional information. In my case, I want to use the scroll
bar to track a rather complex text-formatting process -- hundreds of lines of
code, lots of text-file access, etc. Don't want to put all this inside the
userform's code, so is there any way to feed progress information to the
userform?

Thanks for any help you can offer.

L.

"Jonathan West" wrote:

> Well, you have to define how to measure that progress. The following code in
> the article is purely for demonstration purposes, and you have to replace it
> with your own which not only performs the actions you need but also provides
> a measure of the progress in doing so
>
> For i = 1 To 10000
>
> ' Create 10000 dummy paragraphs in ActiveDocument
> ActiveDocument.Paragraphs.Last.Range. _
> Text = "Test Paragraph " & i & vbCr
>
> ' Increase size of Label1 incrementally
> Label1.Width = i / 50
>
> ' Repaint allows Label1 to display as it is enlarging
> Frame1.Repaint
>
> Next i
>
>
> --
> Regards
> Jonathan West - Word MVP
> www.intelligentdocuments.co.uk
> Please reply to the newsgroup
>
>
>

Re: Progress bar that tracks actual progress?? by leightonwalter

leightonwalter
Tue Jul 15 11:36:05 PDT 2008

Also, I have another process that involves querying a database through a web
page. The query is slow, up to a minute, and I'd like to show "progress"
there, though I can't measure it. Do the query, then the user just has to
wait. Would like a statusbar or something that would tick along, at least
showing the user that *something* was happening. Trouble is, once I start the
process, the VBA program stops until the process is done -- I can't kick off
timer. Similarly, if I start a faux-timer, I can't start the query until the
timer's done. Need to have both running simultaneously. Any options?

Thanks for any help anyone can offer.

L.

"Jonathan West" wrote:

> Well, you have to define how to measure that progress. The following code in
> the article is purely for demonstration purposes, and you have to replace it
> with your own which not only performs the actions you need but also provides
> a measure of the progress in doing so
>
> For i = 1 To 10000
>
> ' Create 10000 dummy paragraphs in ActiveDocument
> ActiveDocument.Paragraphs.Last.Range. _
> Text = "Test Paragraph " & i & vbCr
>
> ' Increase size of Label1 incrementally
> Label1.Width = i / 50
>
> ' Repaint allows Label1 to display as it is enlarging
> Frame1.Repaint
>
> Next i
>
>
> --
> Regards
> Jonathan West - Word MVP
> www.intelligentdocuments.co.uk
> Please reply to the newsgroup
>
>
>

Re: Progress bar that tracks actual progress?? by Karl

Karl
Tue Jul 15 13:55:22 PDT 2008

leightonwalter wrote:
> Thanks for the additional information. In my case, I want to use the scroll
> bar to track a rather complex text-formatting process -- hundreds of lines of
> code, lots of text-file access, etc. Don't want to put all this inside the
> userform's code, so is there any way to feed progress information to the
> userform?

Create a public property for the form.

Public Property Let Progress(ByVal PercentDone As Long)
' Set progress bar value here
End Property

--
.NET: It's About Trust!
http://vfred.mvps.org



Re: Progress bar that tracks actual progress?? by Karl

Karl
Tue Jul 15 13:58:58 PDT 2008

leightonwalter wrote:
> Also, I have another process that involves querying a database through a web
> page. The query is slow, up to a minute, and I'd like to show "progress"
> there, though I can't measure it.

A quandary, yep.

> Do the query, then the user just has to wait.

That's the cost of relying on code you didn't write.

> Would like a statusbar or something that would tick along, at least
> showing the user that *something* was happening.

Animations are a classic answer to this problem. Remember the hourglass cursor in
Windows 3x? Then, the filecopy animation in Win95? Crude, but apparently
entertaining.

> Trouble is, once I start the
> process, the VBA program stops until the process is done -- I can't kick off
> timer. Similarly, if I start a faux-timer, I can't start the query until the
> timer's done. Need to have both running simultaneously. Any options?

Hmmmmm, you might want to try the timer objects I wrote --
http://vb.mvps.org/samples/TimerObj -- I don't believe this limitation would be in
effect but would be interested in finding out if it is. (I know it's not in
standalone VB.)
--
.NET: It's About Trust!
http://vfred.mvps.org



Re: Progress bar that tracks actual progress?? by leightonwalter

leightonwalter
Tue Jul 15 14:50:37 PDT 2008

Will give it a shot -- thanks for your response.

L.

"Karl E. Peterson" wrote:

> leightonwalter wrote:
> > Also, I have another process that involves querying a database through a web
> > page. The query is slow, up to a minute, and I'd like to show "progress"
> > there, though I can't measure it.
>
> A quandary, yep.
>
> > Do the query, then the user just has to wait.
>
> That's the cost of relying on code you didn't write.
>
> > Would like a statusbar or something that would tick along, at least
> > showing the user that *something* was happening.
>
> Animations are a classic answer to this problem. Remember the hourglass cursor in
> Windows 3x? Then, the filecopy animation in Win95? Crude, but apparently
> entertaining.
>
> > Trouble is, once I start the
> > process, the VBA program stops until the process is done -- I can't kick off
> > timer. Similarly, if I start a faux-timer, I can't start the query until the
> > timer's done. Need to have both running simultaneously. Any options?
>
> Hmmmmm, you might want to try the timer objects I wrote --
> http://vb.mvps.org/samples/TimerObj -- I don't believe this limitation would be in
> effect but would be interested in finding out if it is. (I know it's not in
> standalone VB.)
> --
> ..NET: It's About Trust!
> http://vfred.mvps.org
>
>
>