View Single Post
 
Old 11-22-2013, 06:44 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,359
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by Vamosj View Post
The correlation will be that the month will only be linked to the first date picked, so basically the starting month. This will give the office that handles the work assist requests time to deal with the immediate needs and then they can generate another sheet for any work that may lead into the next month.
...
So, if someone was to pick December 5th as the first part of the request date, then the Calendar would display "December 2013" and the calendar dates would adjust as needed to that month.

If it is not possible (I'm trying to stay away from Macro's) to obtain data between tables, then I would like to just create a dropdown menu in the calendar table with the months so the calendar can just adjust itself off of that.
Using content controls, you'll not be able to populate the table without a macro. Without content controls, you don't have access to a calendar content control...

A ContentControlOnExit macro to populate the calendar table from the first of your two calendar content controls (note the allocation of the "StartDate" title) is:
Code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
Application.ScreenUpdating = False
Dim CCtrlDate As Date, i As Long, j As Long, k As Long, Rng As Range
If ContentControl.Title = "StartDate" Then
  CCtrlDate = CDate(ContentControl.Range.Text)
  i = CLng(CCtrlDate) - Format(CCtrlDate, "d") + 1
  j = DateDiff("d", CCtrlDate, DateAdd("m", 1, CCtrlDate))
  With ActiveDocument.Tables(2)
    Set Rng = .Range
    With Rng
      .Start = .Cells(9).Range.Start
      .Delete
    End With
    With .Range
      .Cells(1).Range.Text = "MONTH OF: " & Format(CCtrlDate, "MMMM, YYYY")
      For i = (i - 1) Mod 7 + 9 To .Cells.Count
        k = k + 1
        .Cells(i).Range.Text = k
        If k = j Then Exit For
      Next
    End With
  End With
End If
Set Rng = Nothing
Application.ScreenUpdating = True
End Sub
I still don't see where your second calendar content control comes into play. I'm not even sure whether you want the month populated from day one, or just from the date selected in the first calendar content control.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote