ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Updating form labels from code in a module (https://www.excelbanter.com/excel-programming/280863-updating-form-labels-code-module.html)

news.verizon.net[_2_]

Updating form labels from code in a module
 
I have a VBA program that creates an Excel database from raw data in a flat
file. I launch the program from a command button on a user form. I also have
labels on the form that I would like to update with "lines processed" and
"records completed" numbers, both of which are variables in the program, but
I can't figure out where to put the code to update the labels. Whether I put
the code in the userform module or the main module where the program is, the
labels don't update. Do I need to have some sort of dynamic link between the
form and main modules so they can exchange variables?
I also have a stop command button on the form that I would like to use to
terminate the program if the user clicks it, but the program is mainly a do
loop and once it enters the loop it doesn't check the form code to see if
the button has been pressed.
Any help would be greatly appreciated. I'm relatively new at this.

Thanks,
Chris



[email protected]

Updating form labels from code in a module
 
It may be that you just need to add DoEvents statements in your code.
See the following example by John Walkenbach.

http://j-walk.com/ss/excel/tips/tip34.htm

HTH
Paul
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------

I have a VBA program that creates an Excel database from raw data in a flat
file. I launch the program from a command button on a user form. I also have
labels on the form that I would like to update with "lines processed" and
"records completed" numbers, both of which are variables in the program, but
I can't figure out where to put the code to update the labels. Whether I put
the code in the userform module or the main module where the program is, the
labels don't update. Do I need to have some sort of dynamic link between the
form and main modules so they can exchange variables?
I also have a stop command button on the form that I would like to use to
terminate the program if the user clicks it, but the program is mainly a do
loop and once it enters the loop it doesn't check the form code to see if
the button has been pressed.
Any help would be greatly appreciated. I'm relatively new at this.

Thanks,
Chris



news.verizon.net[_2_]

Updating form labels from code in a module
 
That was it!
Thanks Paul!

wrote in message
...
It may be that you just need to add DoEvents statements in your code.
See the following example by John Walkenbach.

http://j-walk.com/ss/excel/tips/tip34.htm

HTH
Paul
--------------------------------------------------------------------------

------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------

------------------------------------

I have a VBA program that creates an Excel database from raw data in a

flat
file. I launch the program from a command button on a user form. I also

have
labels on the form that I would like to update with "lines processed" and
"records completed" numbers, both of which are variables in the program,

but
I can't figure out where to put the code to update the labels. Whether I

put
the code in the userform module or the main module where the program is,

the
labels don't update. Do I need to have some sort of dynamic link between

the
form and main modules so they can exchange variables?
I also have a stop command button on the form that I would like to use to
terminate the program if the user clicks it, but the program is mainly a

do
loop and once it enters the loop it doesn't check the form code to see if
the button has been pressed.
Any help would be greatly appreciated. I'm relatively new at this.

Thanks,
Chris






All times are GMT +1. The time now is 01:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com