Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1647
  • Last Modified:

Force a form redraw

Is there a way in VBA to force a form to redraw?  It seems as my code is executing changing a control property like whether or not it's visible doesn't take effect until the code completely return and the form doesn't have anything else to do.  Jumping to a new function or using Sleep() doesn't get the form to refresh.

Thanks.
0
JohnSantaFe
Asked:
JohnSantaFe
2 Solutions
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
In VB6, you typically use "DoEvents" to allow the form to process the pending refresh and update itself while staying inside your code block.

Not sure if you can use DoEvents in Excel...

    ...some code..
    DoEvents
    ...some more code..
0
 
thydzikCommented:
have a look at
UserForm1.Repaint

you may have to use
UserForm1.Show vbModeless
0
 
HooKooDooKuCommented:
In VB6 most controls have a .Refresh function that can be called to force a repaint.
0
 
JohnSantaFeAuthor Commented:
Both Repaint and DoEvents seem to work equally well.

Didn't get a chance to try repaint.

Thanks.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now