Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try setting the focus to another control, then set it to the textbox.
-- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Raj" wrote in message ... 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Dec 17, 2:08 pm, "Bob Phillips" wrote:
Try setting the focus to another control, then set it to the textbox. -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Raj" wrote in message ... 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- Hide quoted text - - Show quoted text - Hi Bob, Thanks. It worked. Raj |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Two problems with userforms | Excel Programming | |||
userforms showing and hiding | Excel Programming | |||
problems with userforms | Excel Programming | |||
Hiding Userforms | Excel Programming | |||
modeless userforms | Excel Programming |