Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 12-26-2021, 01:04 AM
Bikram Bikram is offline Replacing_Colors_Of_Document Windows 10 Replacing_Colors_Of_Document Office 2007
Advanced Beginner
Replacing_Colors_Of_Document
 
Join Date: Jul 2021
Location: Nepal
Posts: 97
Bikram is on a distinguished road
Default

Thank you Andrew and Peterson for the replies. Yeah! word doesn't work with CMYK. So, I changed 100% cyan value to RGB which corresponds to 0,174,239, and I have done the same for the 10% cyan value i.e. RGB 255,244,253. I should have used Indesign instead but I prefer working with the msword as it is more convenient and comfortable to work for me. Now, what I want to do is find those two values in the document and change RGB 0,174,239 to RGB 236,0,140 and RBG 255,244,253 to RGB 253,233,241. But they are used in various places such as for shading, borders, text boxes.
Code:
Sub Colorsquiz()
  Dim i As Long
  Dim Rng As Range
  Dim Para As Paragraph
   
  Set Rng = ActiveDocument.Range
  
  Const col1 As Long = RGB(0, 174, 239)
  Const col2 As Long = RGB(255, 244, 253)
  
  

    For i = 1 To Rng.Paragraphs.Count
        Set Para = Rng.Paragraphs(i)
            Para.Range.Select
        Select Case Para.Range.ParagraphFormat.Shading.BackgroundPatternColor
            Case col1
                Para.Range.ParagraphFormat.Shading.BackgroundPatternColor = RGB(236, 0, 140)
            Case col2
                Para.Range.ParagraphFormat.Shading.BackgroundPatternColor = RGB(253, 233, 241)
     
        End Select
     
     ' For Font
        Select Case Para.Range.Font.Color
            Case "(0,174,239)"
                Para.Range.Font.Color = RGB(236, 0, 140)
        End Select
       
    Next i
  
  
End Sub
I tried to implement the above code but It doesn't work. It was for the shading and font. But I also need to change the colors of shapes. How can I achieve the desired result?
Reply With Quote
 



Other Forums: Access Forums

All times are GMT -7. The time now is 09:04 PM.


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