单击文本框时清除文本框中的文本 [英] Clear text in textbox upon clicking it

查看:38
本文介绍了单击文本框时清除文本框中的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个文本框中有文字,上面写着这里有新名字"

I have text in a textbox, which says "NEW NAME HERE"

在 VBA 中是否可以在用户单击该文本框时立即清除此文本?

Is it possible with in VBA to clear this text as soon as the user clicks in that textbox?

如果有的话,请告诉我怎么做?

If so could anyone please let me know how?

谢谢-

推荐答案

假设 TextBox 名为 TextBox1,以下应该可以工作

Assuming the TextBox is named TextBox1, the following should work

Private Sub TextBox1_GotFocus()
    TextBox1.Text = ""
End Sub

这篇关于单击文本框时清除文本框中的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆