Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Clear Contents Of A Text Box In User Form

Hi,

I have a text box in a user form for user to enter a
password. A command button is on the user form for the
user to click "OK" when they have entered the password.If
the incorrect password is entered my macro loops around
for the user to try again. However I cannot get my text
box to clear, so if multiple password attempts are
required, a very long text string is created thus making
it impossible to enter the correct password.

Grateful for help on ways around this.

Thanks
Graham
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Clear Contents Of A Text Box In User Form

Graham,

You don't need to clear it, just select everything so that the next typing
overwrites

With TextBox1
If .Text < "myPassword" Then
MsgBox "Invalis password"
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
End If
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Graham" wrote in message
...
Hi,

I have a text box in a user form for user to enter a
password. A command button is on the user form for the
user to click "OK" when they have entered the password.If
the incorrect password is entered my macro loops around
for the user to try again. However I cannot get my text
box to clear, so if multiple password attempts are
required, a very long text string is created thus making
it impossible to enter the correct password.

Grateful for help on ways around this.

Thanks
Graham



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display contents of a cell in a user form text box -- Excel 2003 VBA hiskilini Excel Discussion (Misc queries) 7 April 4th 23 10:22 AM
Clear a Checkbox in a a user form Cerberus Excel Discussion (Misc queries) 6 June 26th 08 10:41 PM
Adding a new text box to user form Marilyn Excel Discussion (Misc queries) 3 May 13th 07 11:42 PM
User Form: Cannot Update Text Box Charles in Iraq Excel Discussion (Misc queries) 0 October 12th 06 07:53 AM
Submit User Form Contents to next available row jonathan Excel Programming 3 January 25th 04 07:17 PM


All times are GMT +1. The time now is 10:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"