Solved

Force a form redraw

Posted on 2008-10-30
4
1,471 Views
Last Modified: 2008-10-31
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
Comment
Question by:JohnSantaFe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 250 total points
ID: 22845971
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
 
LVL 11

Assisted Solution

by:thydzik
thydzik earned 250 total points
ID: 22846374
have a look at
UserForm1.Repaint

you may have to use
UserForm1.Show vbModeless
0
 
LVL 16

Expert Comment

by:HooKooDooKu
ID: 22847425
In VB6 most controls have a .Refresh function that can be called to force a repaint.
0
 

Author Comment

by:JohnSantaFe
ID: 22854511
Both Repaint and DoEvents seem to work equally well.

Didn't get a chance to try repaint.

Thanks.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question