JohnGow383
Board Regular
- Joined
- Jul 6, 2021
- Messages
- 141
- Office Version
- 2013
- Platform
- Windows
Hi. I have a very simple problem but can't seem to resolve it so thought I'd ask here.
I have userforms where I want the cursor to blink on Textbox1 when the form is first opened. I have a test button for now but the various forms will automatically open when first opening the spreadsheet depending on what condition is met. I have tried the following codes which should work.
and
and
I have these in intialize and also in Userform_Activate
No matter what I try I can't seem to get Textbox 1 to show the flashing cursor.
When I set the userform to ShowModal = TRUE then it works perfectly. I need to have it modeless as there are a couple of buttons on the userform that are hyperlinked to other spreadsheets. These open fine, but the users are telling me if they then close the other spreadsheets the the one with the userform also closes without saving.
I'm no doubt missing something obvious. Thanks in advance
I have userforms where I want the cursor to blink on Textbox1 when the form is first opened. I have a test button for now but the various forms will automatically open when first opening the spreadsheet depending on what condition is met. I have tried the following codes which should work.
VBA Code:
With Me.TextBox1
.SetFocus
End With
VBA Code:
TextBox1.SetFocus
VBA Code:
Userform1.TextBox1.SetFocus
I have these in intialize and also in Userform_Activate
VBA Code:
Private Sub UserForm_Activate()
TextBox1.SetFocus
End Sub
When I set the userform to ShowModal = TRUE then it works perfectly. I need to have it modeless as there are a couple of buttons on the userform that are hyperlinked to other spreadsheets. These open fine, but the users are telling me if they then close the other spreadsheets the the one with the userform also closes without saving.
I'm no doubt missing something obvious. Thanks in advance