Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-13-2020, 06:09 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 select all the shaded texts with particular color

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)
Reply With Quote
  #2  
Old 12-13-2020, 06:21 AM
Charles Kenyon Charles Kenyon is offline select all the shaded texts with particular color Windows 10 select all the shaded texts with particular color Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

For batch processing, see:

For your main question...
  • Do you mean that there is background shading of a particular color or that the text has that color?
  • Have you applied the color using a character style or through direct formatting? If done using a character style, changing font size is trivial. You modify the style.
  • What is the color?

Last edited by Charles Kenyon; 12-14-2020 at 11:02 AM.
Reply With Quote
  #3  
Old 12-13-2020, 06:31 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

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
Attached Files
File Type: docx sample.docx (13.6 KB, 6 views)
Reply With Quote
  #4  
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,101
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 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
  #5  
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

Thread Tools
Display Modes


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 06:36 AM.


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