Results 1 to 2 of 2
Thread: Userform memory (Excel 2003)
2006-02-23, 12:33 #1
- Join Date
- May 2004
- Toronto, Ontario, Canada
- Thanked 0 Times in 0 Posts
Userform memory (Excel 2003)
Does anyone know if there is a way to retain information within a form textbox? Meaning that if a form has a textbox control the user inputs data then, then exits the form, is there a way to record the value, without the data being exposed to the user when the form is closed?
Does a textbox have a limit, or characters that can be input?
2006-02-23, 12:46 #2
- Join Date
- Mar 2002
- Thanked 30 Times in 30 Posts
Re: Userform memory (Excel 2003)
If you want to retain the value while the workbook is open, you can store it in a public variable:
- In a standard module, declare a variable:
Public strValue As String
- In the QueryClose event of the userform:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
strValue = Me.txtSomething.Text
If you want to retain the information even when the workbook is closed, you can store it in a cell in a hidden worksheet, or in a custom document property.
I'm sure that there is a limit to the length of the text in a text box, but you won't run into it anytime soon. I managed to copy over 250,000 characters into a text box without problems.