A Microsoft Office (Excel, Word) forum. OfficeFrustration

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 » OfficeFrustration forum » Microsoft Word » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Calendar control accepts other values



 
 
Thread Tools Display Modes
  #1  
Old March 2nd, 2011, 11:52 PM
jejaram jejaram is offline
Member
 
First recorded activity by OfficeFrustration: Mar 2011
Posts: 1
Default Calendar control accepts other values

I included a calendar control into a template I am creating and if the user selects the down arrow and picks a date, it works fine.

The problem arises if the user doesn't click on the arrow but types anything, the field accepts the text and the purpose of the calendar is exactly to avoid this.

I searched the properties of such command and the only options I found were "Control can't be eliminated" and "Content can't be edited" but none of them prevents entering of text.

So is there a way that the control only accepts a value picked through the choice of a date on the calendar itself?
  #2  
Old March 31st, 2011, 07:53 PM
haritkore haritkore is offline
Member
 
First recorded activity by OfficeFrustration: Dec 2010
Posts: 4
Default

Quote:
Originally Posted by jejaram View Post
I included a calendar control into a template I am creating and if the user selects the down arrow and picks a date, it works fine.

The problem arises if the user doesn't click on the arrow but types anything, the field accepts the text and the purpose of the calendar is exactly to avoid this.

I searched the properties of such command and the only options I found were "Control can't be eliminated" and "Content can't be edited" but none of them prevents entering of text.

So is there a way that the control only accepts a value picked through the choice of a date on the calendar itself?

The last thing I wanted to quickly talk about is the double pipe (||) default operator. This one is terribly useful when you want to make sure that something is set with a default value. The following construct is something that should not show up any longer:
  #3  
Old August 18th, 2011, 08:27 AM
pctech33 pctech33 is offline
Banned
 
First recorded activity by OfficeFrustration: Jun 2011
Posts: 1
Default

Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim pStr As String
If Val(Application.Version) 14 Then Main.SetDeveloperTabActive
pStr = ContentControl.Range.Text
If ContentControl.Type = wdContentControlDate Then
If Not IsDate(pStr) Then
MsgBox "You must enter a date", vbCritical, "Completion error"
Cancel = True
End If
End If
End Sub
 




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 Off
HTML code is Off
Forum Jump


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


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