![]() |
|
#8
|
||||
|
||||
|
You didn't provide a document so I can't tell you what works for your document. You can record adding shading to text so you know what the code should be looking for. Then you can use that in your macro. Note that colours specified from the theme palette are NOT the same as an RGB colour specification.
This code works for me and includes two options that match my test doc depending on whether I specified the colour as RGB or via the palette Code:
Sub FindShade()
Dim wR As Range, wF As Find
Set wR = ActiveDocument.Content
Set wF = wR.Find
With wF
.ClearFormatting
.Font.Shading.Texture = wdTextureNone
'.Font.Shading.BackgroundPatternColor = -738132122 'this is a theme colour tint
.Font.Shading.BackgroundPatternColor = 15652541 'this is a RGB colour that matches the theme colour
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = True
Do While .Execute = True
wR.Select
wR.Font.Bold = True
Loop
End With
End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Show field shading in Content Control
|
ajanson | Word | 3 | 08-15-2016 04:49 PM |
Clicking the selected Content Control checkbox returns wrong control in vba event
|
DougsGraphics | Word VBA | 2 | 06-24-2015 07:31 AM |
Question: How to maintain gray shading in text control box
|
tluken | Word | 1 | 08-23-2012 10:20 AM |
Shading, but only when printed
|
WilltheGrill09 | Word | 1 | 03-27-2012 02:44 AM |
Equations shading
|
b0x4it | Word | 4 | 05-18-2011 07:54 PM |