![]() |
|
#1
|
|||
|
|||
|
I need to select all the shaded texts with particular color in order to change the font size . VBA macro? and if that's possible for many documents (batch) |
|
#2
|
|||
|
|||
|
For batch processing, see:
For your main question...
Last edited by Charles Kenyon; 12-14-2020 at 11:02 AM. |
|
#3
|
|||
|
|||
|
for my main question:
-there is a background shading, the text has nothing -I haven't applied the color, I pasted the text from a web page -the color is like this sample |
|
#4
|
||||
|
||||
|
The following macro will clear the shading and set the font as required when used with my add-in mentioned by Charles. I have included a test macro to call it.
Code:
Sub Test()
RemShading ActiveDocument
End Sub
Function RemShading(oDoc As Document) As Boolean
Dim oPara As Paragraph
On Error GoTo err_Handler
For Each oPara In oDoc.Paragraphs
If oPara.Shading.BackgroundPatternColor = RGB(255, 255, 230) Then
oPara.Shading.BackgroundPatternColor = wdColorAutomatic 'remove the shading
oPara.Range.Font.Name = "Calibri" 'The font you wish to apply
oPara.Range.Font.Size = 12 'The font size
End If
Next oPara
RemShading = True
lbl_Exit:
Exit Function
err_Handler:
RemShading = False
Err.Clear
Resume lbl_Exit
End Function
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#5
|
|||
|
|||
|
thank you very much, it's working
![]()
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Select color palette using vba
|
Catty | Word VBA | 3 | 10-08-2015 09:32 PM |
| Macro to select a custom color palette | Catty | Word VBA | 0 | 05-06-2015 05:12 AM |
change color of critical activity texts
|
ketanco | Project | 3 | 01-05-2012 06:36 PM |
| Select Series Color - Macro | judicial85 | Excel Programming | 0 | 03-14-2011 02:35 PM |
Select text by color
|
Invain | Word | 1 | 02-14-2010 07:08 AM |