View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default getting the cursor to show in a textbox

Private Sub CommandButton1_Click()

UserForm2.Hide
TextBox1.Text = ""
Textbox1.Setfocus
End Sub

might work.

--
Regards,
Tom Ogilvy

"Simon Lloyd " wrote in message
...
Hi all,

I have created a userform to act as a password input box and if the
password is a match then do a couple of things...which it does quite
happily.....but next time the tool bar button is clicked to which i
assigned the macro the userform pops up the Textbox has no cursor
flashing in it so you have to have another mouse click to select the
box before typing the password.

Anyone know how to get the cursor blinking in the textbox each time its
opened?

Here's some snippets of code:-

Sub Admin()
'
' Admin Macro
' Macro recorded 21/06/2004 by Simon
'

'
UserForm2.Show
End Sub

Private Sub CommandButton1_Click()

UserForm2.Hide
TextBox1.Text = ""
End Sub

Private Sub TextBox1_Change()
If TextBox1.Text = "pass" Then
Application.CommandBars.ActiveMenuBar.Enabled = True
Worksheets("Hidden").Visible = True
ElseIf TextBox1.Text < "pass" Then
Exit Sub

End If
Me.Hide
End Sub


---
Message posted from http://www.ExcelForum.com/