Night_Rain
Board Regular
- Joined
- Jan 1, 2005
- Messages
- 181
I'm stumped, and hope someone here might be able to help. I have been trying to cut out extraneous code written by the macro recorder, and I find my paired down version does two things I do not want:
1. It inserts a "0" just prior to all of the inserted page-breaks
2. It sometimes fails to replace all, only replacing the first instance
Here is the current code:
What is a clean why to code multiple replace alls?
1. It inserts a "0" just prior to all of the inserted page-breaks
2. It sometimes fails to replace all, only replacing the first instance
Here is the current code:
Code:
Sub Futures_and_Expedites()
'5/23/05: rewritten bpg
Application.ScreenUpdating = False
With ActiveDocument.Content.Find
.Execute FindText:="prior to^p", ReplaceWith:="prior to ", Replace:=wdReplaceAll
.Execute FindText:="there is^p", ReplaceWith:="there is ", Replace:=wdReplaceAll
.Execute FindText:="invoice^p", ReplaceWith:="invoice ", Replace:=wdReplaceAll
.Execute FindText:="necessary^p", ReplaceWith:="necessary ", Replace:=wdReplaceAll
.Execute FindText:="can^p", ReplaceWith:="can ", Replace:=wdReplaceAll
.Execute FindText:="do not^p", ReplaceWith:="do not ", Replace:=wdReplaceAll
.Execute FindText:="provide status", ReplaceWith:="provide the status", Replace:=wdReplaceAll
.Execute FindText:="^p^p^p^p", ReplaceWith:="^p", Replace:=wdReplaceAll
.Execute FindText:="^p^p^p", ReplaceWith:="^p", Replace:=wdReplaceAll
.Execute FindText:="Please^p", ReplaceWith:="Please ", Replace:=wdReplaceAll
.Execute FindText:="required^p", ReplaceWith:="required ", Replace:=wdReplaceAll
.Execute FindText:="these^p", ReplaceWith:="these ", Replace:=wdReplaceAll
.Execute FindText:="delivery^p", ReplaceWith:="delivery.^p", Replace:=wdReplaceAll
.Execute FindText:="Thank you,", ReplaceWith:="Thank you,^p^"
.Execute FindText:="posted.^p", ReplaceWith:="posted.^p^p "
End With
With ActiveDocument.Content.Find
.Execute FindText:="Contact: __________________", ReplaceWith:="", Replace:=wdReplaceAll
.Execute FindText:=Date & " Future Delivery", ReplaceWith:="^m" _
& Date & " Future Delivery", Replace:=wdReplaceAll
.Execute FindText:=Date & " Purchasing", ReplaceWith:="^m" & Date _
& " Purchasing", Replace:=wdReplaceAll
End With
Selection.HomeKey Unit:=wdStory
Selection.Delete wdCharacter, 2
With ActiveDocument.PageSetup
.LineNumbering.Active = False
.Orientation = wdOrientPortrait
.TopMargin = InchesToPoints(0.2)
.BottomMargin = InchesToPoints(0.2)
.LeftMargin = InchesToPoints(0.25)
.RightMargin = InchesToPoints(0.25)
.Gutter = InchesToPoints(0)
.HeaderDistance = InchesToPoints(0.5)
.FooterDistance = InchesToPoints(0.5)
.SectionStart = wdSectionNewPage
End With
ActiveWindow.View.Type = wdPageView
End Sub
What is a clean why to code multiple replace alls?