Textbox mask for textboxes in my Userform (Excel 2007)


"Excel VBA Help"

 


Play Friv Now - Play Friv Games
Go Back   The Code Cage Forums > Resource Forums > Microsoft Office Topics Archive > Excel Archives
Our Info Pages:-
The Code Cage - Microsoft Office help

Notices

Excel Archives All Older Excel threads are saved here in one forum

New Reply
Thread Tools Display Modes
  #1  
Unread 21st July 2009, 18:00
Webtechie's Avatar
Webtechie
Newsgroup Contributor
 
Posts: n/a
Posts Per Day: 0
My Top Tip Count:
Default Textbox mask for textboxes in my Userform (Excel 2007)
     


------ Register to get rid of these "In Post" ads! ------

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.

The Code Cage Advertisment
Advertisement
  #2  
Unread 21st July 2009, 18:41
Joel's Avatar
Joel
Newsgroup Contributor
 
Posts: n/a
Posts Per Day: 0
My Top Tip Count:
Default RE: Textbox mask for textboxes in my Userform (Excel 2007)

------ Register to get rid of these "In Post" ads! ------


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  
Unread 21st July 2009, 18:49
Joel's Avatar
Joel
Newsgroup Contributor
 
Posts: n/a
Posts Per Day: 0
My Top Tip Count:
Default RE: Textbox mask for textboxes in my Userform (Excel 2007)

------ Register to get rid of these "In Post" ads! ------


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.


The Code Cage Advertisment
Advertisement
  #4  
Unread 21st July 2009, 19:19
Webtechie's Avatar
Webtechie
Newsgroup Contributor
 
Posts: n/a
Posts Per Day: 0
My Top Tip Count:
Default RE: Textbox mask for textboxes in my Userform (Excel 2007)

------ Register to get rid of these "In Post" ads! ------


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  
Unread 21st July 2009, 19:45
Joel's Avatar
Joel
Newsgroup Contributor
 
Posts: n/a
Posts Per Day: 0
My Top Tip Count:
Default RE: Textbox mask for textboxes in my Userform (Excel 2007)

------ Register to get rid of these "In Post" ads! ------


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  
Unread 21st July 2009, 19:54
Joel's Avatar
Joel
Newsgroup Contributor
 
Posts: n/a
Posts Per Day: 0
My Top Tip Count:
Default RE: Textbox mask for textboxes in my Userform (Excel 2007)

------ Register to get rid of these "In Post" ads! ------


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.


The Code Cage Advertisment
Advertisement

To stop seeing these ads and get other benefits check This page!

New Reply
The Code Cage at Facebookhe Code Cage at Twitter


Tags
2007, excel, mask, textbox, textboxes, userform

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

The Code Cage Affilliates



http://www.thecodecage.com/forumz tested by McAfee Security http://www.thecodecage.com/forumz tested by McAfee Security

All times are GMT +1. The time now is 06:53.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Template-Modifications by TMS
No part of this board, functionality or creatives may be copied or reproduced either in part or full without the express permission of The Code Cage Team.
Copyright ©2008 - , Simon lloyd.
We are not associated with nor employed by Microsoft in any way, we simply provide resources!
All MS office icons are registered trademarks of the application they represent and are used with permission from Microsoft
UA-8135493-1
Cultural Forum | Study at Malaysian University