oWord.Selection.WholeStory oWord.Selection.Fields.Unlink oWord.Selection.HomeKey(wdStory) && remove all hypinksThe following sometimes works:
** go to top of doc first oWord.Selection.Find.ClearFormatting && next find oWord.Selection.Find.Replacement.ClearFormatting With oWord.Selection.Find && remove those pictures .Text = "^g" .Replacement.Text = " " EndWith IF oWord.Selection.Find.Found oWord.Selection.Find.Execute(wdReplaceAll) endif *WAIT WINDOW "pictures"And this never works and I don’t know why.
oWord.Selection.HomeKey(wdStory) && go home oWord.Selection.Find.ClearFormatting && ready for find and delete oWord.Selection.Find.Replacement.ClearFormatting With oWord.Selection.Find *.Text = "Print | Close Window" .Text = "Print" .Replacement.Text = " " .replacement.paragraphFormat.leftIndent = 12 lFound = .execute( , , , , , , , , , , wdReplaceAll) *********************1 5 10************* EndWith oWord.Selection.Find.Execute(wdReplaceAll)On the other hand this always works:
oWord.Selection.HomeKey(wdStory) && go home oWord.Selection.Find.ClearFormatting oWord.Selection.Find.Font.Bold = .F. oWord.Selection.Find.Replacement.ClearFormatting With oWord.Selection.Find .Text = "" .Replacement.Text = " " .Forward = .F. .Format = .F. .MatchCase = .F. .MatchWholeWord = .F. .MatchWildcards = .F. .MatchSoundsLike = .F. .MatchAllWordForms = .F. EndWith oWord.Selection.Find.Execute oWord.Selection.Copy ** file 22 *WAIT WINDOW "first bold title"Another problem I have faced, is that when the code does “find” something (as in the above), I have not been able to figure out how to pass the found text to a variable? As a result I resorted to the following, since the found text is always at the start of the document. It would be great to know how to pass found text to a variable.
titleRange = ALLTRIM(oWord.ActiveDocument.Range(0,50).Text)Since I cannot upload a sample word doc I am attaching a JPEG to show what one looks like,