Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-13-2020, 10:04 PM
gmayor's Avatar
gmayor gmayor is offline select all the shaded texts with particular color Windows 10 select all the shaded texts with particular color Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
  #2  
Old 12-14-2020, 05:49 AM
jackiru jackiru is offline select all the shaded texts with particular color Windows 7 32bit select all the shaded texts with particular color Office 2010
Novice
select all the shaded texts with particular color
 
Join Date: Dec 2020
Posts: 4
jackiru is on a distinguished road
Default

thank you very much, it's working
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
select all the shaded texts with particular color 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
select all the shaded texts with particular color 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 all the shaded texts with particular color Select text by color Invain Word 1 02-14-2010 07:08 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:29 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft