(Solved) – VBA Excel, Permanently Save/Update Textbox Input

(solved)-–-vba-excel,-permanently-save/update-textbox-input

How would you save or update a TextBox with its own value the user has inputted?

Example, I have a Userform with a TextBox for “password”. Every user who opens the file will enter his own password in that TextBox, then save the file and reopen at any given time.

Note, the value should be saved permanently in that file (not only session based), so even after completely closing and reopening the file, the users password should be there in the Textbox until its changed again.

Passing the value to cell isn’t a good idea, since its a password and shouldn’t be visible.

I used so far below code, to no avail.

In the UF code for “Save” button:

Private Sub CommandButton1_Click()
    SavePWStrings
    Me.Hide
End Sub

In the standard module:

Public Sub SavePWStrings()
Dim pw As String
    pw = UserForm1.TextBox1.Value
    UserForm1.TextBox1 = pw
End Sub

Goal is to update the value of the TextBox programmatically as below.

Thanks

enter image description here

Leave a Reply

Your email address will not be published. Required fields are marked *