A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » Excel Programming
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Textbox mask for textboxes in my Userform (Excel 2007)



 
 
Thread Tools Display Modes
  #1  
Old July 21st 09, 05:59 PM posted to microsoft.public.excel.programming
Webtechie
external usenet poster
 
Posts: 84
Default Textbox mask for textboxes in my Userform (Excel 2007)

Hello,

I need my users to input a two character day and two character month for the
date (I don't need the year). I can give a default year if need be.

I don't see the masked edit control in Excel 2007.

How do you control how data is keyed in the textboxes of the userforms?

Thanks.
Ads
  #2  
Old July 21st 09, 06:41 PM posted to microsoft.public.excel.programming
joel
external usenet poster
 
Posts: 9,101
Default Textbox mask for textboxes in my Userform (Excel 2007)

Use ISDARE to validae the date. Build a sring like I did below. I hardcoded
a string to give you an idea how to do this. You can also read the string
from a text box like the code Icommented out below.

Do

'datestr = textbox1.value
datestr = "1302"
MyDate = Left(datestr, 2) & "/" & Mid(datestr, 2, 2) & "/" & Year(Date)
If IsDate(MyDate) Then
Exit Do
Else
MsgBox ("Bad Date - Enter Date again")
End If

Loop

"Webtechie" wrote:

> Hello,
>
> I need my users to input a two character day and two character month for the
> date (I don't need the year). I can give a default year if need be.
>
> I don't see the masked edit control in Excel 2007.
>
> How do you control how data is keyed in the textboxes of the userforms?
>
> Thanks.

  #3  
Old July 21st 09, 06:47 PM posted to microsoft.public.excel.programming
joel
external usenet poster
 
Posts: 9,101
Default Textbox mask for textboxes in my Userform (Excel 2007)

Use ISDATE to validae the date. Build a sring like I did below. I hardcoded
a string to give you an idea how to do this. You can also read the string
from a text box like the code Icommented out below.

Do

'datestr = textbox1.value
datestr = "1302"
MyDate = Left(datestr, 2) & "/" & Mid(datestr, 2, 2) & "/" & Year(Date)
If IsDate(MyDate) Then
Exit Do
Else
MsgBox ("Bad Date - Enter Date again")
End If

Loop

"Webtechie" wrote:

> Hello,
>
> I need my users to input a two character day and two character month for the
> date (I don't need the year). I can give a default year if need be.
>
> I don't see the masked edit control in Excel 2007.
>
> How do you control how data is keyed in the textboxes of the userforms?
>
> Thanks.

  #4  
Old July 21st 09, 07:16 PM posted to microsoft.public.excel.programming
Webtechie
external usenet poster
 
Posts: 84
Default Textbox mask for textboxes in my Userform (Excel 2007)

Joel,

Thanks Joel, that sure helps after the fact. Any idea of how to notify the
user as they are typing. Along the same lines as the masked edit control?

Thanks,

Tony

"Joel" wrote:

> Use ISDATE to validae the date. Build a sring like I did below. I hardcoded
> a string to give you an idea how to do this. You can also read the string
> from a text box like the code Icommented out below.
>
> Do
>
> 'datestr = textbox1.value
> datestr = "1302"
> MyDate = Left(datestr, 2) & "/" & Mid(datestr, 2, 2) & "/" & Year(Date)
> If IsDate(MyDate) Then
> Exit Do
> Else
> MsgBox ("Bad Date - Enter Date again")
> End If
>
> Loop
>
> "Webtechie" wrote:
>
> > Hello,
> >
> > I need my users to input a two character day and two character month for the
> > date (I don't need the year). I can give a default year if need be.
> >
> > I don't see the masked edit control in Excel 2007.
> >
> > How do you control how data is keyed in the textboxes of the userforms?
> >
> > Thanks.

  #5  
Old July 21st 09, 07:42 PM posted to microsoft.public.excel.programming
joel
external usenet poster
 
Posts: 9,101
Default Textbox mask for textboxes in my Userform (Excel 2007)

The masked edit control is part of access 2007. I suspect that if you added
the microsoft access object library 12.0 as a reference to your VBA project
and then create an access object you should be able to get to the control. I
haven't used the edit control before. How are you opening up the control in
2003?

"Webtechie" wrote:

> Joel,
>
> Thanks Joel, that sure helps after the fact. Any idea of how to notify the
> user as they are typing. Along the same lines as the masked edit control?
>
> Thanks,
>
> Tony
>
> "Joel" wrote:
>
> > Use ISDATE to validae the date. Build a sring like I did below. I hardcoded
> > a string to give you an idea how to do this. You can also read the string
> > from a text box like the code Icommented out below.
> >
> > Do
> >
> > 'datestr = textbox1.value
> > datestr = "1302"
> > MyDate = Left(datestr, 2) & "/" & Mid(datestr, 2, 2) & "/" & Year(Date)
> > If IsDate(MyDate) Then
> > Exit Do
> > Else
> > MsgBox ("Bad Date - Enter Date again")
> > End If
> >
> > Loop
> >
> > "Webtechie" wrote:
> >
> > > Hello,
> > >
> > > I need my users to input a two character day and two character month for the
> > > date (I don't need the year). I can give a default year if need be.
> > >
> > > I don't see the masked edit control in Excel 2007.
> > >
> > > How do you control how data is keyed in the textboxes of the userforms?
> > >
> > > Thanks.

  #6  
Old July 21st 09, 07:53 PM posted to microsoft.public.excel.programming
joel
external usenet poster
 
Posts: 9,101
Default Textbox mask for textboxes in my Userform (Excel 2007)

The masked edit control is in MSMASK32.OCX. You probably can copy this file
from the windows system32 folder in an windows XP application. You may also
have to copy the DLL. Not sure if there are other libraries you will need.
This library was not distributed with Vista but from what I found on the web
it can be installed on Vista. The comments were to contact the deplorer of
your Vista software if you need the library.

"Webtechie" wrote:

> Joel,
>
> Thanks Joel, that sure helps after the fact. Any idea of how to notify the
> user as they are typing. Along the same lines as the masked edit control?
>
> Thanks,
>
> Tony
>
> "Joel" wrote:
>
> > Use ISDATE to validae the date. Build a sring like I did below. I hardcoded
> > a string to give you an idea how to do this. You can also read the string
> > from a text box like the code Icommented out below.
> >
> > Do
> >
> > 'datestr = textbox1.value
> > datestr = "1302"
> > MyDate = Left(datestr, 2) & "/" & Mid(datestr, 2, 2) & "/" & Year(Date)
> > If IsDate(MyDate) Then
> > Exit Do
> > Else
> > MsgBox ("Bad Date - Enter Date again")
> > End If
> >
> > Loop
> >
> > "Webtechie" wrote:
> >
> > > Hello,
> > >
> > > I need my users to input a two character day and two character month for the
> > > date (I don't need the year). I can give a default year if need be.
> > >
> > > I don't see the masked edit control in Excel 2007.
> > >
> > > How do you control how data is keyed in the textboxes of the userforms?
> > >
> > > Thanks.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
excel input mask for textbox DaveF[_2_] Excel Discussion (Misc queries) 3 February 20th 08 03:25 PM
Need A date Mask format for a Textbox on UserForm [email protected] Excel Discussion (Misc queries) 2 November 4th 07 02:27 AM
Input for TextBox having a mask for date or $ amount jlroper[_4_] Excel Programming 2 September 25th 05 03:17 PM
Create a mask inside a textbox dok112[_42_] Excel Programming 1 September 17th 05 12:45 AM
Input mask for userform textbox Axehandler Excel Programming 1 November 6th 04 03:56 AM


All times are GMT +1. The time now is 02:09 PM.


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