M
Martin Beir
Two questions for the group.
Answers gratefully received.
I have placed a textbox on a Userform.
I have written code for the 'EXIT' event associated with this textbox:
"If Textbox1 (does not meet condition) Then Cancel=-1".
This is simple and prevents the User exiting the textbox without first
making a valid entry.
However, if I introduce a message box:
"If Textbox1 (does not meet condition) Then Msgbox "You must enter an
integer": Cancel=-1
I find that when the Message box is closed focus does not return fully to
the textbox. Pressing the delete key will erase text in the textbox but it
is not possible to make an entry in the textbox without first clicking the
textbox with mouse. Indeed, until the mouse is clicked on the textbox there
is no visible cursor.
Is there anyway of overcoming this?
If a user is prevented from exiting a control e.g. as example above, the
other controls on the Userform are effectively disabled as they cannot
receive focus. This is for the most part desirable but it would in some
cases be useful if the cancel button still functioned. A CommandButton with
code: "Unload Me" does not funtion if it is preventd from receiving focus.
Is it possible (other than using the red system button, top left-hand
corner) to create a "Super Control" which is not restricted?
I look forward to receiving your answers.
Seasons' Greetings to all,
Martin
Answers gratefully received.
I have placed a textbox on a Userform.
I have written code for the 'EXIT' event associated with this textbox:
"If Textbox1 (does not meet condition) Then Cancel=-1".
This is simple and prevents the User exiting the textbox without first
making a valid entry.
However, if I introduce a message box:
"If Textbox1 (does not meet condition) Then Msgbox "You must enter an
integer": Cancel=-1
I find that when the Message box is closed focus does not return fully to
the textbox. Pressing the delete key will erase text in the textbox but it
is not possible to make an entry in the textbox without first clicking the
textbox with mouse. Indeed, until the mouse is clicked on the textbox there
is no visible cursor.
Is there anyway of overcoming this?
If a user is prevented from exiting a control e.g. as example above, the
other controls on the Userform are effectively disabled as they cannot
receive focus. This is for the most part desirable but it would in some
cases be useful if the cancel button still functioned. A CommandButton with
code: "Unload Me" does not funtion if it is preventd from receiving focus.
Is it possible (other than using the red system button, top left-hand
corner) to create a "Super Control" which is not restricted?
I look forward to receiving your answers.
Seasons' Greetings to all,
Martin