![]() |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
Hello all,
I've been trying unsuccessfully to search for a phrase, select 2 words before it, then italicize the text (including the phrase I searched for). The code I have below is entirely unsuccessful, and somehow just deletes "and Michael". Any suggestions? Sub Macro2() Selection.Find.ClearFormatting With Selection.Find .Text = "and Michael" .Replacement.Text = "and Michael" .Forward = True .Wrap = wdFindStop Do While .Execute() = True Selection.TypeParagraph Selection.MoveLeft Unit:=wdWord, Count:=2, Extend:=wdExtend Selection.Find.Replacement.Font.Italic = True Selection.Font.Bold = True Selection.Collapse Direction:=wdCollapseEnd Loop End With End Sub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
BrotherDude | Word VBA | 4 | 07-15-2015 05:42 PM |
Microsoft Word macro to find text, select all text between brackets, and delete | helal1990 | Word VBA | 4 | 02-05-2015 03:52 PM |
![]() |
Marko | Word VBA | 2 | 10-18-2014 06:32 AM |
VBA to Find and Format Text string defined using Inputbox within selection | sistemalan | Word VBA | 7 | 10-03-2014 07:28 AM |
![]() |
mkhuebner | Word VBA | 8 | 02-04-2014 08:04 PM |