Changing label1.caption during CommandButton1_Click()

S

Slow Flyer

I'm using the CommandButton1_Click() event to start
processing data from a long file in a Do Loop. I was
intending to watch the progress using label1.caption =
Cstr(CurrentRecord) placed within the Do Loop. But
label1.caption is only changed on completion of the
CommandButton1_Click()event.
i.e. label1.caption just shows the final record number.

Any ideas please; on how to have label1.caption change as
each file record is processed?
 
J

Jonathan West

Hi Slow Flyer,

Put the following code immediately after the line where the captrion is
changed

Me.Repaint
DoEvents
DoEvents
DoEvents

The Me.Repaint command forces a redraw of the userform. The DoEvents command
ensure that the macro releases the processor for long enough for the redraw
command to be processed by Windows.

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
 
S

Slow Flyer

Thanks for your help with this and with previous posts.
For those wishing to exploit the extensive capability of
the software, it makes this a most valuable forum.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top