ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disappearing Text in textbox (https://www.excelbanter.com/excel-programming/294741-disappearing-text-textbox.html)

scottnshelly[_11_]

Disappearing Text in textbox
 
i gotta userform with some text boxes. the people that will be usin
this userform are not computer literate. is it possible to put text i
the textbox like "type here" but make the text go away when it'
clicked? i've tried a few things like
textbox1.value = "type here"
private sub textbox1_click
textbox1.value = ""

no soup.
what else should i try?
thanks MVP's

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


Vasant Nanavati

Disappearing Text in textbox
 
Try:

Private Sub TextBox1_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
TextBox1 = ""
End Sub

--

Vasant


"scottnshelly " wrote in
message ...
i gotta userform with some text boxes. the people that will be using
this userform are not computer literate. is it possible to put text in
the textbox like "type here" but make the text go away when it's
clicked? i've tried a few things like
textbox1.value = "type here"
private sub textbox1_click
textbox1.value = ""

no soup.
what else should i try?
thanks MVP's!


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




scottnshelly[_12_]

Disappearing Text in textbox
 
Thanks,
i knew it would be something along those lines.
Way to go

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


David

Disappearing Text in textbox
 
Vasant Nanavati wrote

Private Sub TextBox1_MouseDown(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
TextBox1 = ""
End Sub


Is there something similar I can use to detect when a user starts typing an
entry into TextBox1 to make default "<store name" go away?

--
David

David

Disappearing Text in textbox
 
David wrote

Is there something similar I can use to detect when a user starts
typing an entry into TextBox1 to make default "<store name" go away?


Got it worked:

Private Sub UserForm_Initialize()
With Me.TextBox1
..Text = "<store name"
..SelStart = 0
..SelLength = Len(.Text)
End With
End Sub

--
David


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com