#1
|
|||
|
|||
Replace only non-italic occurrences.
I need to replace some words, but not italic ones, this code does not works: (It is replacing all occurrences, even in italic) Code:
For x = 0 To UBound(TxtF) With .Range.Find .Text = TxtF(x) .Replacement.Text = TxtS(x) .Format = True .Font.Italic = False .MatchWholeWord = False .MatchCase = True .Execute Replace:=wdReplaceAll End With Next x Thanks Ps. SORRY using vba breakpoints I found that the problem was elsewhere in the code.
__________________
Backup your original file before doing any modification. Last edited by eduzs; 05-02-2022 at 03:13 PM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
"Find and Replace" tool leaves out many of the occurrences of what I put in the "find" window | Swarup | Word | 8 | 06-24-2021 08:31 PM |
Macro to format all occurrences of a text in a table | Dzib | Word VBA | 11 | 08-05-2019 11:24 PM |
Variable text field code based on occurrences on each page | Cosmo | Word | 2 | 12-29-2015 11:54 AM |
how to italic the word with vba | tomlam | Excel Programming | 1 | 02-03-2014 07:09 PM |
Replace all occurrences of one merge field with plain text | blankenthorst | Mail Merge | 5 | 07-01-2011 05:18 AM |