Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can't see cursor or selected text in textbox even though it has fo
I have a textbox on a userform that is validated before updating. The
problem is that after an invalid date is entered by the user, the focus returns to the textbox but it is not activated--i.e., no keyboard input is accepted except the tab key and shift tab. I want the textbox selected or a cursor present so that the user can reenter data into the textbox. (By the way, the routine below works the same even when omitting the lines containing SelStart, SelLength, and SetFocus.) Private Sub StartDate_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean) Dim mytext As String mytext = CheckDateEntry(StartDate) If mytext = "invalid" Then Cancel = True StartDate.SelStart = 0 StartDate.SelLength = Len(StartDate.Text) StartDate.SetFocus End If End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can't see cursor or selected text in textbox even though it has fo
Code worked OK for me.
-- Regards, Tom Ogilvy "KHanna" wrote in message ... I have a textbox on a userform that is validated before updating. The problem is that after an invalid date is entered by the user, the focus returns to the textbox but it is not activated--i.e., no keyboard input is accepted except the tab key and shift tab. I want the textbox selected or a cursor present so that the user can reenter data into the textbox. (By the way, the routine below works the same even when omitting the lines containing SelStart, SelLength, and SetFocus.) Private Sub StartDate_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean) Dim mytext As String mytext = CheckDateEntry(StartDate) If mytext = "invalid" Then Cancel = True StartDate.SelStart = 0 StartDate.SelLength = Len(StartDate.Text) StartDate.SetFocus End If End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can't see cursor or selected text in textbox even though it ha
Tom,
Thanks for the reply. My problem was that I opened the form with the parameter "vbmodeless". After removing it, it works fine. "Tom Ogilvy" wrote: Code worked OK for me. -- Regards, Tom Ogilvy "KHanna" wrote in message ... I have a textbox on a userform that is validated before updating. The problem is that after an invalid date is entered by the user, the focus returns to the textbox but it is not activated--i.e., no keyboard input is accepted except the tab key and shift tab. I want the textbox selected or a cursor present so that the user can reenter data into the textbox. (By the way, the routine below works the same even when omitting the lines containing SelStart, SelLength, and SetFocus.) Private Sub StartDate_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean) Dim mytext As String mytext = CheckDateEntry(StartDate) If mytext = "invalid" Then Cancel = True StartDate.SelStart = 0 StartDate.SelLength = Len(StartDate.Text) StartDate.SetFocus End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Highlight all Text in a Textbox when the textbox is selected | Excel Programming | |||
How to move cursor from one textbox control to another textbox con | Excel Programming | |||
How to move cursor from one textbox control to another textbox con | Excel Programming | |||
getting the cursor to show in a textbox | Excel Programming | |||
cursor selected range from a text box | Excel Programming |