Consulting

Results 1 to 3 of 3

Thread: Userform Repaint

  1. #1

    Userform Repaint

    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.
    [VBA]
    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
    [/VBA]

  2. #2
    VBAX Mentor Teeroy's Avatar
    Joined
    Apr 2012
    Location
    Sydney, Australia
    Posts
    414
    Location
    Try replacing
    [VBA]ufStatus.Repaint[/VBA]
    with
    [VBA]DoEvents[/VBA]
    _________________________________________________________________________
    "In theory there is no difference between theory and practice. In practice there is." - Chuck Reid

    Any day you learn something new is a day not wasted.

  3. #3
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,722
    Location
    Why does the function try to reshow the userform every time it updates it?
    Be as you wish to seem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •