![]() |
|
#1
|
|||
|
|||
![]()
Good point, and I agreed. Not trying to get "free" advise without me doing my homework or putting a good effort. I do.
Before posting anything, I spent a good amount of hours searching the net and your site for answers. Unfortunately, I don't have the necessary skills to come out sometimes with a workable code or solution. Yesterday, you gave me a workable find/replace code; I try to modify it for something else--spent more than two hours trying to find a solution but couldn't do it. Anyway, please accept my apologies, and as always I thank you for your valuable cooperation. Here is a sample code I found on the web so I can bold what I want. Still working on the color issue. Sincerely PHP Code:
|
#2
|
||||
|
||||
![]() Quote:
Code:
Sub AnswerLetterChange() With ActiveDocument.Content.Find .ClearFormatting .Replacement.ClearFormatting .Forward = True .Wrap = wdFindContinue .Format = False .MatchWildcards = True .Text = "<([A-D]):" .Replacement.Text = "\1." .Execute Replace:=wdReplaceAll End With End Sub Code:
Sub Demo1() With ActiveDocument.Content.Find .ClearFormatting .Replacement.ClearFormatting .Forward = True .Wrap = wdFindContinue .Format = False .MatchWildcards = True .Text = "([A-Z]).*[Aa]nswer*( is[ in]{1,3}correct.)" .Replacement.Text = "Answer (\1)\2" .Execute Replace:=wdReplaceAll End With End Sub Code:
Sub Demo2() With ActiveDocument.Content.Find .ClearFormatting .Replacement.ClearFormatting .Forward = True .Wrap = wdFindContinue .Format = False .MatchWildcards = True .Text = "(Answer )([A-Z])" .Replacement.Text = "\1(\2)" .Execute Replace:=wdReplaceAll End With End Sub As for applying the bold and highlight, if you use the macro recorder to capture a Find/Replace using those parameters, it will provide all the bits of code you need. Granted, it can be made more efficient, but all the font/highlight attributes will be there.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
rsrasc | Word VBA | 2 | 11-11-2014 09:46 AM |
![]() |
Ulodesk | Word | 1 | 06-23-2014 10:26 AM |
Wildcard Find/Replace deletes extra character | Cosmo | Word | 1 | 06-20-2014 08:49 AM |
![]() |
Cayce | Word | 1 | 06-09-2014 04:17 PM |