View Single Post
 
Old 01-26-2023, 05:39 PM
cavals07 cavals07 is offline Windows 10 Office 2010
Novice
 
Join Date: Jan 2023
Posts: 5
cavals07 is on a distinguished road
Default

Hi Andrew, holy moly yes it works perfectly. Just what I am hoping for! Thank you so much for revising my code for me and for the additional information regarding the requirement for same name and placement within the ThisDocument.

If I wanted to use that code a second time in the same macro (ie. to have second the "Response Received" checkbox change its text colour, can you advise me what I need to include in between the two codes to make that work?

When I copy and paste the code back-to-back and only revise "Awaiting Response" to "Response Received", it prompts me with an error as followed: "Compile error: Ambiguous name detected: Document_ContentControlOnExit"

Code:
Private Sub Document_ContentControlOnExit(ByVal aCC As ContentControl, Cancel As Boolean)
  If aCC.Title = "Awaiting Response" Then
    If aCC.Checked = True Then
      aCC.Range.Paragraphs(1).Range.Font.ColorIndex = wdRed
    Else
      aCC.Range.Paragraphs(1).Range.Font.ColorIndex = wdGreen
    End If
  End If
End Sub

Private Sub Document_ContentControlOnExit(ByVal aCC As ContentControl, Cancel As Boolean)
  If aCC.Title = "Response Received" Then
    If aCC.Checked = True Then
      aCC.Range.Paragraphs(1).Range.Font.ColorIndex = wdRed
    Else
      aCC.Range.Paragraphs(1).Range.Font.ColorIndex = wdGreen
    End If
  End If
End Sub
Reply With Quote