General discussion
Thread display: Collapse - |
All Comments
Start or search
Create a new discussion
If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.
Word Macro: how do I loop it until end of file EOF
[pre]
=========begin macro=========
PHP Code:
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^$^p^$"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=" "
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveRight Unit:=wdCharacter, Count:=1
End Sub
========end macro===========
[/pre]
This is to replace the Returns with a Space in a word file that are in the middle of a sentence.
Even if you know of a better way, I would still like to know how to repeat any macro till the end of file.
I can't do a Search-and-Replace because ^$ is not a valid thing for the Replace With box, which is obvious. I also don't know how set conditions in VBA.
Thousand thanks!