Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

word 2007 disable past dates in datepicker

Status
Not open for further replies.

aspag

Programmer
Jan 15, 2004
17
US

Hello
I have selected from MS WORD 2007, Developer section the Date Picker and set the Title and Tag to TargetDate.
I would like the end user to select only today or future dates and not be able to select past dates. Past dates can either be grayed or not be available.
I have added following codes and not sure if they are correct. New to VB.
Private Sub UserForm_Initialize()
' Check if active cell contains a date. If 'yes' show
' same date on calendar. If 'no' show today's date.
If IsDate(ActiveCell.Value) Then
targetdate.Value = DateValue(ActiveCell.Value)
Else
targetdate.Value = Date
End If
End Sub
--------------------------------
Sub targetdate()
' targetdate Macro
Targetdate.mindate.Value = Date
End Sub

Can anyone shed any light on this?


Thanks in advance
 
Hello: It will greatly appreciated, if someone can provide a link or can this be done with the datepicker control...
 
You say "I have selected from MS WORD 2007", but your code has:

ActiveCell.Value

This is an Excel object.

Further, you have
Code:
targetdate.Value
which implies this is an object. But you also have;
Code:
Sub targetdate()
' targetdate  Macro
Targetdate.mindate.Value = Date
End Sub
which seems to use the same name. This is very confusing...and I am confused.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top