Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-29-2023, 04:02 AM
chris.james chris.james is offline CHange colour of text box if has a tick or a X Windows 10 CHange colour of text box if has a tick or a X Office 2021
Novice
CHange colour of text box if has a tick or a X
 
Join Date: Sep 2023
Posts: 1
chris.james is on a distinguished road
Default CHange colour of text box if has a tick or a X

HI.



I use vba on excel fairly regularly but just started to use on word and ill be honest im confused on what i thought would be a basic thing to do.

I have lots of checkboxes in a word doc and when i click on a checkbox it brings up a tick and a x. So far so good with no vba.

Now what i want is that when the checkbox is clicked if this brings up the tick the checkbox goes green and if it brings up a x the checkbox goes red.

I found the following code but it isnt performing how i hoped.

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
CHange colour of text box if has a tick or a X Change "fill" text colour to no colour darkmaster006 Word VBA 15 08-22-2023 10:10 AM
Change Text Colour/Box Shade if CheckBox is marked cavals07 Word VBA 7 01-30-2023 11:05 AM
Change text colour for content control labels? Toe Word 1 01-17-2019 08:45 AM
Change Text Colour in Cell Based on Text in Same Cell PMC11 Word VBA 1 11-14-2017 09:15 PM
CHange colour of text box if has a tick or a X Quickest way to change text to Arial size 11 specific colour BlueClearSky Word 6 11-22-2013 03:34 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:45 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft