Visio Guy

Visio Discussions => Shapes & Templates => Topic started by: michaelj1103 on May 19, 2022, 06:21:57 PM

Title: Conditional formatting text color depending on text itself
Post by: michaelj1103 on May 19, 2022, 06:21:57 PM
I was wondering if it was possible for format the character color based off of the actual text itself? So for example, if the text contained the characters 123, then it would change all the characters red. So the text ABC123 would look like that. And if 123 was not in the text then it would just be Black. Thanks.
Title: Re: Conditional formatting text color depending on text itself
Post by: Surrogate on May 19, 2022, 09:33:08 PM
Quote from: michaelj1103 on May 19, 2022, 06:21:57 PMI was wondering if it was possible for format the character color based off of the actual text itself? So for example, if the text contained the characters 123, then it would change all the characters red. So the text ABC123 would look like that. And if 123 was not in the text then it would just be Black.
If I understand the condition correctly: if the length of the text sequence is more than 3 characters and the last three characters are 123, then the font is red (value 2). In all other cases the font is black (value 0).

You must activate Developer mode, and open ShapeSheet environment window (hope this video can helps, just see first minute).
In ShapeSheet window scroll and find Character section.
(https://user-images.githubusercontent.com/35092915/202869305-667c4c3b-7295-4d00-a3f2-198cd3fa7402.png)
Write formula [tt]IF(AND(STRSAME(RIGHT(SHAPETEXT(TheText),3),"123"),LEN(SHAPETEXT(TheText))>3),2,0)[/tt] in cell Color in Character section.
(https://user-images.githubusercontent.com/35092915/202869235-6b8e47fa-9fe0-4900-b3d5-c385520dc5da.gif) (https://surrogate-tm.w3spaces.com/gifs/FontColor.gif)
Title: Re: Conditional formatting text color depending on text itself
Post by: michaelj1103 on May 20, 2022, 06:17:13 PM
That works perfect. Thank you for your help!