george hart
Board Regular
- Joined
- Dec 4, 2008
- Messages
- 241
Hi
This code looks for text "P/Car" jumps to the left of it and deletes certain data below.
What I need however, is for the code find "P/Car", select the text below it and delete it by scrolling down the text untill it = "".
I guess the "Count:=21," needs changing but I dont know how???
WordApp.Activate
WordApp.Selection.Find.ClearFormatting
With WordApp.Selection.Find
.Text = "P/Car"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
WordApp.Selection.Find.Execute
WordApp.Selection.MoveLeft Unit:=wdWord, Count:=1
WordApp.Selection.MoveDown Unit:=wdLine, Count:=1
WordApp.Selection.MoveRight Unit:=wdWord, Count:=11, Extend:=wdExtend
WordApp.Selection.MoveDown Unit:=wdParagraph, Count:=21, Extend:=wdExtend
WordApp.Selection.Delete Unit:=wdCharacter, Count:=1
WordApp.Selection.PasteSpecial Link:=False, DataType:=wdPasteText, _
Placement:=wdInLine, DisplayAsIcon:=False
This code looks for text "P/Car" jumps to the left of it and deletes certain data below.
What I need however, is for the code find "P/Car", select the text below it and delete it by scrolling down the text untill it = "".
I guess the "Count:=21," needs changing but I dont know how???
WordApp.Activate
WordApp.Selection.Find.ClearFormatting
With WordApp.Selection.Find
.Text = "P/Car"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
WordApp.Selection.Find.Execute
WordApp.Selection.MoveLeft Unit:=wdWord, Count:=1
WordApp.Selection.MoveDown Unit:=wdLine, Count:=1
WordApp.Selection.MoveRight Unit:=wdWord, Count:=11, Extend:=wdExtend
WordApp.Selection.MoveDown Unit:=wdParagraph, Count:=21, Extend:=wdExtend
WordApp.Selection.Delete Unit:=wdCharacter, Count:=1
WordApp.Selection.PasteSpecial Link:=False, DataType:=wdPasteText, _
Placement:=wdInLine, DisplayAsIcon:=False