Link to home
Start Free TrialLog in
Avatar of mrwad99
mrwad99Flag for United Kingdom of Great Britain and Northern Ireland

asked on

Style to change highlight/font whilst maintaining word colouring!

Ah hello.

I am using Word 2007, and I would like to create a style that changes the background of the text to grey, the font to courier, but keeps the colouring of the original words the same.  Please see the image below.  

User generated image
I can figure out how to get the font to change to courier, but I can't see how to get the background to grey without applying it to the whole paragraph (I only want to apply it to the *selection*).  Also, Word does not seem to remember the original colour of the words when I apply the font: they all go to black.

Secondly, can someone tell me how, once this style is setup, to get Word to ignore the spelling of any parts of the document that have this style applied please?

(100 points/question)

TIA
ASKER CERTIFIED SOLUTION
Avatar of Paul Sauvé
Paul Sauvé
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mrwad99

ASKER

Hi paulsauve,

Thanks for that.  I downloaded your document and tried the style: it works fine apart from the fact that if you apply the style to words that have different colours, the original colours is forgotten: they all go black.  See the image below.
 User generated image
Is there any way we can maintain the original colouring of the words, just change the font and the highlight?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mrwad99

ASKER

Use ONLY select Shading tab and choose a colour

Sorry, I don't understand what you mean.  I am not a very competent Word user at the best of times (I don't have need to be) so can you explain in simple terms please?

TIA
"Use ONLY select Shading tab and choose a colour" See "2 - select Borders and Shading" as above
OR

Select the text

Select Text highlight color:User generated image
Select colour:User generated image
Is that ok?
Avatar of mrwad99

ASKER

Oh right, I understand you now.  So basically you are saying take the paragraph shading out of the style and apply it manually.

Not really what I wanted, but I was playing with macros and it seems I can do all of this without having to define a style: I can just record the steps to change the highlight of the selected text, then change the font and font size etc.

Either way, you have helped me, so thanks.  The points are yours :)
If you create a macro, FIRST, you have to be able to locate the string of text that is NOT the same colour as the rest of the text in the document.



Avatar of mrwad99

ASKER

I don't see what you mean.  The macro body is

    Options.DefaultHighlightColorIndex = wdGray25
    Selection.Range.HighlightColorIndex = wdGray25
    Selection.Font.Name = "Courier New"

which simply gets the highlighted text, then changes the highlight colour and font.  It leaves everything else in the selection the same, which includes the words colouring.
Yes, but how does the macro find the text to highlight? That was my point of the above comment.
Avatar of mrwad99

ASKER

No, I have to highlight the text first.  But that is what I would be doing with styles anyway: I would highlight the text I wish to apply the style to, then click the style itself.  This does not have the benefit that I could not change the style, then have all pieces of text with that style applied updated automatically, but I am willing to accept this since retaining the original colouring of the words is too important.  Thanks again.