ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Masking on TextBox (https://www.excelbanter.com/excel-programming/331062-masking-textbox.html)

Santiago[_2_]

Masking on TextBox
 
Hi guys, me again.

Does somebody know how to mask input data in a TextBox? I'd like only dates
to be inserted so that I can use it afterwords as a filter for bringing data
from Access Database.

Thanks
Bregards

Santiago

Norie

Masking on TextBox
 

Santiago

As far as I know you can't use/create input masks in Excel

Can't you just check a date has been entered in the textbox Exit
event?

Code:
--------------------

Private Sub Textbox1_Exit(Cancel As Boolean)
If Not IsDate(Textbox1.Value) Then
Msgbox "Please enter a date."
Cancel = True
End If
End Sub

--------------------


--
Norie
------------------------------------------------------------------------
Norie's Profile: http://www.excelforum.com/member.php...o&userid=19362
View this thread: http://www.excelforum.com/showthread...hreadid=376862


Santiago[_2_]

Masking on TextBox
 
yes, would work, but was hoping there was a masking solution... thanks

"Norie" wrote:


Santiago

As far as I know you can't use/create input masks in Excel

Can't you just check a date has been entered in the textbox Exit
event?

Code:
--------------------

Private Sub Textbox1_Exit(Cancel As Boolean)
If Not IsDate(Textbox1.Value) Then
Msgbox "Please enter a date."
Cancel = True
End If
End Sub

--------------------


--
Norie
------------------------------------------------------------------------
Norie's Profile: http://www.excelforum.com/member.php...o&userid=19362
View this thread: http://www.excelforum.com/showthread...hreadid=376862




All times are GMT +1. The time now is 08:04 AM.

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