ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA: Text Box Property (MASK?) (Easy Question) (https://www.excelbanter.com/excel-programming/315936-vba-text-box-property-mask-easy-question.html)

Mcasteel[_25_]

VBA: Text Box Property (MASK?) (Easy Question)
 

I want to create a "mask" for my text box, but Im not sure how, I dont
see a clearly labled property for this.

I simply want the text box to show as a Date format:

"__ / __ / ____"

Does anyone know the best way to do this?

Thank you.


--
Mcasteel
------------------------------------------------------------------------
Mcasteel's Profile: http://www.excelforum.com/member.php...o&userid=15698
View this thread: http://www.excelforum.com/showthread...hreadid=275787


Dave Peterson[_4_]

VBA: Text Box Property (MASK?) (Easy Question)
 
Excel doesn't support this kind of masking.

But you could format your value nicely before you put it in the textbox (or
after it's entered, reformat it):

textbox1.text = format(date, "mm/dd/yyyy")

or

if isdate(textbox1.text) then
textbox1.text = format(textbox1.text, "mm/dd/yyyy")
end if

Mcasteel wrote:

I want to create a "mask" for my text box, but Im not sure how, I dont
see a clearly labled property for this.

I simply want the text box to show as a Date format:

"__ / __ / ____"

Does anyone know the best way to do this?

Thank you.

--
Mcasteel
------------------------------------------------------------------------
Mcasteel's Profile: http://www.excelforum.com/member.php...o&userid=15698
View this thread: http://www.excelforum.com/showthread...hreadid=275787


--

Dave Peterson



All times are GMT +1. The time now is 02:59 AM.

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