Jump to content
Macro Express Forums

Can Macros Recognize Colored Text?


macronoob7

Recommended Posts

So here is my dilemma, I am trying to find out if I can have Macro Express differentiate from different colored text.

 

I have a macro that I am building that will become much easier if the macro is smart enough to recognize the color of text in an excel spreadsheet. Essentially if it can recognize the color of text I want it to run a certain macro, if it sees another text color it would not run it.

 

I think this is kind of a shot in the dark, but if it works this will save me a ton of time.

Link to comment
Share on other sites

So here is my dilemma, I am trying to find out if I can have Macro Express differentiate from different colored text.

 

I have a macro that I am building that will become much easier if the macro is smart enough to recognize the color of text in an excel spreadsheet. Essentially if it can recognize the color of text I want it to run a certain macro, if it sees another text color it would not run it.

 

I think this is kind of a shot in the dark, but if it works this will save me a ton of time.

 

Use the Get Pixel Color command, after reading the Help about it. Follow that with IF Variable tests.

 

--

Terry, East Grinstead, UK

Link to comment
Share on other sites

I was curious to see how one could find the text so I ran a quick test. You need to find a cell you know will have text and select it (Text Type Ctrl+G followed by cell ref/Enter). If you move the mouse to the text cursor, it will be the top left corner of the cell. You can adjust mouse position vertically to the centreline of the cell and then run across the cell a few pixels at a time with a Repeat loop until you find a colour not equal to background or gridline.

 

You could also format the cell (Text Type Ctrl+1), go to Font tab (Text Type F), move mouse to colour bar which will always be in the same place relative to Format Cells window and get the colour (or get colour at specific coords). Then Text Type Esc to Cancel.

 

I have an old rev of Excel so there could be differences.

Edited by JohnS
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...