Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88081

After setting ActiveX textbox to empty value, previous text briefly appears in box before disappearing again

$
0
0

I created a data entry form on a spreadsheet using ActiveX TextBoxes. These are coupled with a submit details button and a clear data button. Both buttons at the end of execution set the text boxes back to blank to be refilled by the next user.

After the boxes are set to "", when the user begins filling the form each time the user selects one of the text boxes the previous entry details briefly appear in the text box then disappear.

This is a quite frustrating issue as I am trying to make it so the previous users details are hidden.

I searched many articles on the best way to set text boxes to empty and it seems that the main way is to set the .text property to "". There seems to be no mention of this behavior.

Sub clearForm()
'    Worksheets("Student Data").userName.Text = ""'    Worksheets("Student Data").emailAddr.Text = ""'    Worksheets("Student Data").contactNum.Text = ""'    Worksheets("Student Data").Course.Text = ""'    Worksheets("Student Data").gradDate.Text = ""'    Worksheets("Student Data").addComment.Text = ""

    textbox1clear
End Sub

Sub submitData()
    'Code here that takes users entered data and outputs to hidden and protected sheet    

    'After data copied text boxes are cleared of users information, same as above sub
    Worksheets("Student Data").userName.Text = ""
    Worksheets("Student Data").emailAddr.Text = ""
    Worksheets("Student Data").contactNum.Text = ""
    Worksheets("Student Data").Course.Text = ""
    Worksheets("Student Data").gradDate.Text = ""
    Worksheets("Student Data").addComment.Text = ""
End Sub

Sub textbox1clear()
    Dim sel
    sel = Selection.Address
    Sheet1.userName.Activate
    Application.SendKeys ("Test ")
    Sheet1.userName.Value = ""
    Range(sel).Activate
End Sub

Expected - Text boxes should be clear of data ready for next user.

Actual - Text boxes are clear until user selects them to begin entering data at which point previous entry briefly appears in the box and disappears again.


Viewing all articles
Browse latest Browse all 88081

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>