View Single Post
 
Old 12-11-2023, 07:58 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Set the title in the date CC to 'Effective Date' and then add this code to the ThisDocument module
Code:
Private Sub Document_ContentControlOnExit(ByVal oCC As ContentControl, Cancel As Boolean)
  Dim ccDate As ContentControl, dteEffectiveDate As Date
  If oCC.Title = "Type of Transaction" Then
    Select Case oCC.Range.Text
      Case "Reclassification", "Transfer", "Change of Pay Rate"
        Set ccDate = ActiveDocument.SelectContentControlsByTitle("Effective Date")(1)
        If Not ccDate.ShowingPlaceholderText Then
          dteEffectiveDate = CDate(ccDate.Range.Text)
          If Format(dteEffectiveDate, "ddd") <> "Mon" Then
            ccDate.Range.Select
            MsgBox "You silly billy, the effective date has to be a Monday now you've chosen that!", vbOKOnly + vbCritical, "WTF"
          End If
        End If
    End Select
  End If
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote