PC Review


Reply
Thread Tools Rate Thread

application.statusbar updates freeze

 
 
Robert Flanagan
Guest
Posts: n/a
 
      22nd Mar 2010
I have some code that updates the statusbar with the row number being
processed. Sometimes this update freezes but the code keeps running. Is
there a way to force the statusbar to update all the time?

For example

For r = 1 to 60000
application.statusbar "processing row " & r
next

will freeze. I've tried doing it every 10, 20, 100 rows and it will still
freeze. I can do a ctl-break and resume, but I don't want users to do that
obviously.


 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      22nd Mar 2010
You could try adding doEvents in your code. It'll allow the operating system a
little time to do what it needs to do.

You could even do it every so often (depending on what else you do in your real
loop).

Dim r As Long
For r = 1 To 60000
Application.StatusBar = "processing row " & r
If r Mod 50 = 0 Then
DoEvents
End If
Next r

Robert Flanagan wrote:
>
> I have some code that updates the statusbar with the row number being
> processed. Sometimes this update freezes but the code keeps running. Is
> there a way to force the statusbar to update all the time?
>
> For example
>
> For r = 1 to 60000
> application.statusbar "processing row " & r
> next
>
> will freeze. I've tried doing it every 10, 20, 100 rows and it will still
> freeze. I can do a ctl-break and resume, but I don't want users to do that
> obviously.


--

Dave Peterson
 
Reply With Quote
 
Robert Flanagan
Guest
Posts: n/a
 
      22nd Mar 2010
Thanks Dave. I ust did what you suggested. And added a lot of different
screen activity. I ended up doing something like:

if rnd() > .995 then
statusbar and doevents and select cell
end if

which kept the screen changing. Problably slowed things down by 10-20% but
no one will complain.

Bob
"Dave Peterson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> You could try adding doEvents in your code. It'll allow the operating
> system a
> little time to do what it needs to do.
>
> You could even do it every so often (depending on what else you do in your
> real
> loop).
>
> Dim r As Long
> For r = 1 To 60000
> Application.StatusBar = "processing row " & r
> If r Mod 50 = 0 Then
> DoEvents
> End If
> Next r
>
> Robert Flanagan wrote:
>>
>> I have some code that updates the statusbar with the row number being
>> processed. Sometimes this update freezes but the code keeps running. Is
>> there a way to force the statusbar to update all the time?
>>
>> For example
>>
>> For r = 1 to 60000
>> application.statusbar "processing row " & r
>> next
>>
>> will freeze. I've tried doing it every 10, 20, 100 rows and it will
>> still
>> freeze. I can do a ctl-break and resume, but I don't want users to do
>> that
>> obviously.

>
> --
>
> Dave Peterson



 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      22nd Mar 2010

I'm not sure why you're selecting the cell. There's not that many things that
need to have a specific cell selected.

And don't forget to turn calculation to manual, screenupdating to off, do the
work, calc back to automatic (or whatever it was before) and screenupdating to
on.

Robert Flanagan wrote:
>
> Thanks Dave. I ust did what you suggested. And added a lot of different
> screen activity. I ended up doing something like:
>
> if rnd() > .995 then
> statusbar and doevents and select cell
> end if
>
> which kept the screen changing. Problably slowed things down by 10-20% but
> no one will complain.
>
> Bob
> "Dave Peterson" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > You could try adding doEvents in your code. It'll allow the operating
> > system a
> > little time to do what it needs to do.
> >
> > You could even do it every so often (depending on what else you do in your
> > real
> > loop).
> >
> > Dim r As Long
> > For r = 1 To 60000
> > Application.StatusBar = "processing row " & r
> > If r Mod 50 = 0 Then
> > DoEvents
> > End If
> > Next r
> >
> > Robert Flanagan wrote:
> >>
> >> I have some code that updates the statusbar with the row number being
> >> processed. Sometimes this update freezes but the code keeps running. Is
> >> there a way to force the statusbar to update all the time?
> >>
> >> For example
> >>
> >> For r = 1 to 60000
> >> application.statusbar "processing row " & r
> >> next
> >>
> >> will freeze. I've tried doing it every 10, 20, 100 rows and it will
> >> still
> >> freeze. I can do a ctl-break and resume, but I don't want users to do
> >> that
> >> obviously.

> >
> > --
> >
> > Dave Peterson


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application.StatusBar or equivalent for user defined functions Bob Nyholm Microsoft Excel Programming 3 18th Apr 2008 08:52 PM
Application.StatusBar not refreshing after ThisWorkbook.Close LEO@KCC Microsoft Excel Programming 6 12th Sep 2007 10:41 AM
How to reset the Application.StatusBar PCLIVE Microsoft Excel Programming 7 1st Aug 2006 05:18 PM
TextBox vs. Label vs. StatusBar with displaying updates to user =?Utf-8?B?SG9tZXI=?= Microsoft Dot NET Framework Forms 3 2nd Mar 2004 07:57 PM
How to change the Application StatusBar font characteristics Ian Millward Microsoft Access Forms 0 12th Jan 2004 12:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:12 PM.