![]() |
|
|
Thread Tools | Display Modes |
#3
|
||||
|
||||
![]()
It is probably quicker to look for the character than to step through each cell, then determine if it is in a table and if the cell it is in has the required shading.
Code:
Sub ReplaceInTable() Dim orng As Range Set orng = ActiveDocument.Range With orng.Find Do While .Execute(FindText:="%") If orng.Information(wdWithInTable) Then If orng.Cells(1).Shading.BackgroundPatternColor = RGB(63, 123, 196) Then orng.Text = " CB" orng.Collapse 0 End If End If Loop End With lbl_Exit: Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Setting a particular table cell background color when an option button is selected in Word 2007 | a888 | Word VBA | 11 | 03-25-2015 05:33 AM |
![]() |
rohanrohith | Word VBA | 3 | 11-27-2014 01:08 PM |
![]() |
pintree3 | Word | 5 | 10-27-2014 10:23 AM |
Word VBA Find Table Text Shading Colour and replace with another | QA_Compliance_Advisor | Word VBA | 10 | 09-19-2014 08:36 AM |
how to search and replace BOLD text >> font color change? | dylansmith | Word | 4 | 03-12-2013 09:51 PM |