R
Raj
I have a modeless useform. When the user switches to another workbook,
the userform has to be hidden, and, when the user switches back to the
workbook, the userform should be shown again. Everytime the userform
is shown, the cursor/insertion pointer should appear in textbox1.
The following code is used:
--For displaying the cursor/insertion pointer in textbox1
Private Sub UserForm_Activate()
With UserForm1
.Top = Application.Top + 200 '< change 125 to what u want
.Left = Application.Left + 635 '< change 25 to what u want
End With
UserForm1.TextBox1.SetFocus
UserForm1.TextBox1.Text = ""
End Sub
--For Hiding the userform when the workbook is deactivated:
Private Sub Workbook_Deactivate()
UserForm1.Hide
End Sub
--For showing the userform when the workbook is activated:
Private Sub Workbook_Activate()
UserForm1.Show
End Sub
Everything works as expected except that the cursor/insertion pointer
is not appearing in textbox1. What should I do to achieve this?
Thanks in advance for all the help.
Regards,
Raj
the userform has to be hidden, and, when the user switches back to the
workbook, the userform should be shown again. Everytime the userform
is shown, the cursor/insertion pointer should appear in textbox1.
The following code is used:
--For displaying the cursor/insertion pointer in textbox1
Private Sub UserForm_Activate()
With UserForm1
.Top = Application.Top + 200 '< change 125 to what u want
.Left = Application.Left + 635 '< change 25 to what u want
End With
UserForm1.TextBox1.SetFocus
UserForm1.TextBox1.Text = ""
End Sub
--For Hiding the userform when the workbook is deactivated:
Private Sub Workbook_Deactivate()
UserForm1.Hide
End Sub
--For showing the userform when the workbook is activated:
Private Sub Workbook_Activate()
UserForm1.Show
End Sub
Everything works as expected except that the cursor/insertion pointer
is not appearing in textbox1. What should I do to achieve this?
Thanks in advance for all the help.
Regards,
Raj