![]() |
|
#1
|
|||
|
|||
|
Hi,
I want to create a Macro that links two Content Controls. When the user selects the date in the first box, it appears again in the second box. If the user selects a Sunday or Saturday, The second box defaults to the Monday. Right now I have: Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Dim CCtrl As ContentControl, LngDt As Long
If ContentControl.Title <> "StartDate" Then Exit Sub
LngDt = CDate(ContentControl.Range.Text)
For Each CCtrl In ActiveDocument.ContentControls
If CCtrl.Title = "EndDate" Then
With CCtrl
.LockContents = False
.Range.Text = Format(LngDt, "DD MM YYYY")
.LockContents = False
End With
ElseIf CDate(ContentControl.Range.Text) Mod 7 = 1 Then
With CCtrl
.LockContents = False
.Range.Text = Format(Int(CDate(ContentControl.Range.Text) / 7) * 7 + 2, "DD MM YYYY")
.LockContents = False
End With
End If
Next
End Sub
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Date Picker
|
Andy2011 | Word VBA | 4 | 11-24-2012 10:07 PM |
Color picker eye dropper ???
|
stoneygeorge | PowerPoint | 7 | 08-28-2012 12:32 AM |
word 2003 date picker
|
nashville | Word | 16 | 04-06-2012 04:12 AM |
| Date picker | trintukaz | Excel | 0 | 12-30-2011 12:42 AM |
| Calculations using values from date picker controls | Inkarnate | Word | 0 | 06-09-2010 07:16 AM |