Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Userform memory (Excel 2003)

    Hi all,

    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?

    Thanks,
    Darryl.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 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
    End Sub

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •