Archive of Mr Excel Message Board


Back to Excel VBA archive index
Back to archive home



clear text box values

Posted by jeff on July 18, 2001 8:32 AM
Is it possible to clear text box values in a form? I am trying to clear the values to reuse a userform. The first time it works, but when i try to reuse it, the old values that were entered come in again. Any ideas?

Thanks in advance

jeff


Check out our Excel VBA Resources

Re: clear text box values

Posted by Cory on July 18, 2001 9:13 AM
I wish I knew what code you were using to clear the values the first time. Have you tried unloading the form then reloading it? That usually clears all values.

Ex:

Private Sub CommandButton1_Click()
Unload UserForm1
Load Userform1
UserForm1.Show
End Sub


Re: clear text box values

Posted by jeff on July 18, 2001 9:27 AM
YES THANKS

Re: clear text box values

Posted by Ivan F Moala on July 18, 2001 7:49 PM

Private Sub ClearCtrls()
Dim FrmsCtrl As MSForms.Control

For Each FrmsCtrl In Me.Controls
If TypeName(FrmsCtrl) = "TextBox" Then
FrmsCtrl.Text = ""
End If
Next
End Sub


Ivan




This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.