PDA

View Full Version : Userform Repaint



IRish3538
11-08-2012, 02:04 PM
I have a userform inside a workbook that acts as a progress bar. I have it as a function and during different parts of a large sub, the function is called, status bar moves. The overall sub is blanketed with screenupdating turned off so I "repaint" the status bar userform so it updates... the only problem is that everytime the function is called, the workbook gets activated. so the user cant go off and let it run in the background.

here's my code (not sure it'll help). im assuming it's the repaint that's causing the issue.

Function Func_Update_Status_Bar(width, caption1, caption2, incr)

ufStatus.Show vbModeless
ufStatus.lblStatus.width = width + incr
ufStatus.Caption = caption1
ufStatus.lblStatus2.Caption = caption2
ufStatus.Repaint

End Function

Teeroy
11-09-2012, 12:22 AM
Try replacing
ufStatus.Repaint
with
DoEvents

Aflatoon
11-09-2012, 01:05 AM
Why does the function try to reshow the userform every time it updates it?