View Single Post
 
Old 01-06-2013, 05:01 PM
Jennifer Murphy's Avatar
Jennifer Murphy Jennifer Murphy is offline Windows XP Office 2007
Competent Performer
 
Join Date: Aug 2011
Location: Silicon Valley
Posts: 234
Jennifer Murphy is on a distinguished road
Default Testing for a printable character

Is there a good way to test whether a character is one that would be displayed on screen and printed?

I'm working on a little macro to change each character in a string of text to a random color according to some theme. For the Christmas theme, each letter would be changed to red or green. For Halloween, orange or black.

The macro limits the number of consecutive characters that can be assigned the same color. The problem is that non-printing characters, like space and tab, defeat the limit.

If I set the limit to 3, then the macro will not allow more than three consecutive characters to be assigned the same color. But it will happily allow three characters on either side of a space to all be red as long as the space is green. But since the space is non-printing, it looks like there are 6 red characters.
Reply With Quote