I hope my question is well-formed. If not, please ask for clarification.
Summary: VBA Need way to detect "mousedown" or something like it in dynamically created textbox
I have a dynamically creatd userform which asks for user input using code like:
Set SFPQtyValue = UserForm9.Controls.Add("Forms.TextBox.1", arrayS(varSowCounter - 1, 1) & "datum" & varSowCounter)
User input is a text box which defaults to zero, but after user entry could be 0, 1, 2, etc.
There is a maximum for the total of all text boxes, if the user exceeds the maximum, then all are set to zero.
Problem is that if user accidentally selects the left side of the existing number, then things get too large. If the existing value is "0" and the user wants to enter 2, then the value can become 20.
I want to select all text on entry so that does not happen using code such as:
With TextBox1
.SelStart = 0
.SelLength = Len(.Text)
End With
However, that requires detection that user clicked in the textbox.
It is mandatory requirement that the user not accidentally enter the large number, so I am seeking help.
Summary: VBA Need way to detect "mousedown" or something like it in dynamically created textbox
I have a dynamically creatd userform which asks for user input using code like:
Set SFPQtyValue = UserForm9.Controls.Add("Forms.TextBox.1", arrayS(varSowCounter - 1, 1) & "datum" & varSowCounter)
User input is a text box which defaults to zero, but after user entry could be 0, 1, 2, etc.
There is a maximum for the total of all text boxes, if the user exceeds the maximum, then all are set to zero.
Problem is that if user accidentally selects the left side of the existing number, then things get too large. If the existing value is "0" and the user wants to enter 2, then the value can become 20.
I want to select all text on entry so that does not happen using code such as:
With TextBox1
.SelStart = 0
.SelLength = Len(.Text)
End With
However, that requires detection that user clicked in the textbox.
It is mandatory requirement that the user not accidentally enter the large number, so I am seeking help.