Dav1000
06-22-2009, 12:10 PM
Hi all from a new member.
I have designed and coded a VBA program that utilizes a user-form as the data input/output interface when run. Below is abbreviated version of my code, where inputs are:
variable = TextBox#.Text (where # = 0 to 9)
and outputs are:
Label#.Caption =calculated value. (where # = 19 to 52)
This runs and works well. However, I am attempting to code in a second command button sub routine that clears the input and output boxes without the end user having to close the application. This is so the application can be run with multiple scenarios without closing and restarting the application ad naseum...
For the input text boxes this works when I use the code:
Textbox#.Value = Null.
But, When I attempt the same with the label#.Caption = null I get:
run-time error '94';
Invalid use of null.
I have tried Label.Value and Label.Text which are not recognized by VBA as valid data members.
However, When I use Label#.Caption = 0 in the subroutine it does reset the output labels to "0".
My question is( since I have not found the answer in any other resources), do any of you know if what I am attempting is the correct method or is it even possible to clear a Label used as an output on a userform using a command button subroutine?
Thank you.
Dav1000
I have designed and coded a VBA program that utilizes a user-form as the data input/output interface when run. Below is abbreviated version of my code, where inputs are:
variable = TextBox#.Text (where # = 0 to 9)
and outputs are:
Label#.Caption =calculated value. (where # = 19 to 52)
This runs and works well. However, I am attempting to code in a second command button sub routine that clears the input and output boxes without the end user having to close the application. This is so the application can be run with multiple scenarios without closing and restarting the application ad naseum...
For the input text boxes this works when I use the code:
Textbox#.Value = Null.
But, When I attempt the same with the label#.Caption = null I get:
run-time error '94';
Invalid use of null.
I have tried Label.Value and Label.Text which are not recognized by VBA as valid data members.
However, When I use Label#.Caption = 0 in the subroutine it does reset the output labels to "0".
My question is( since I have not found the answer in any other resources), do any of you know if what I am attempting is the correct method or is it even possible to clear a Label used as an output on a userform using a command button subroutine?
Thank you.
Dav1000