Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

Form Repainting Problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ybazizi - 25 Jan 2006 15:30 GMT
I have a label on a form that I use to show the progress of a loop.  It works
great except if I change the focus to a different application and then return
to excel.  Doing so freezes the label where it was when I changed the focus.  
Is there a to get the form to start refreshing again?

Thanks

For i = 1 To LastRow
  lblStatus.Caption = i & " of " & LastRow
  frmStatus.Repaint
  ...the rest of the loop
Next i
Tom Ogilvy - 25 Jan 2006 15:40 GMT
Perhaps

For i = 1 To LastRow
   lblStatus.Caption = i & " of " & LastRow
   frmStatus.Repaint
   doevents
   ...the rest of the loop
Next i

Signature

Regards,
Tom Ogilvy

> I have a label on a form that I use to show the progress of a loop.  It works
> great except if I change the focus to a different application and then return
[quoted text clipped - 8 lines]
>    ...the rest of the loop
> Next i
ybazizi - 25 Jan 2006 16:30 GMT
The DoEvents did the trick.  Thanks!

> Perhaps
>
[quoted text clipped - 20 lines]
> >    ...the rest of the loop
> > Next i
Crowbar - 25 Jan 2006 15:54 GMT
Don't know how useful this is but I found pausing the application works with
things like this, this will pause the loop for half a second that usaully is
more than enough time for the computer to refresh

Dim PauseTime, Start, Finish

For i = 1 To LastRow

   PauseTime = 0.5  ' Set duration.
   Start = Timer    ' Set start time.
   Do While Timer < Start + PauseTime
   Loop
   Finish = Timer    ' Set end time.

lblStatus.Caption = i & " of " & LastRow
 frmStatus.Repaint
 ...the rest of the loop
Next i
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.