JPDO
08-07-2006, 05:32 AM
Hi,
I have to manipulate some data in a Word-document using VBA.
First i have to search for the word ?Director? in a document.
If i found it i should select from there till the rest of the document and set this selection with fonttype = ?Courier New? / 9pts
If i do not find it i should search for the word ?SIGNED?.
This word is always present in the document.
When i find it i should delete it and from there on till the end of the document i should set the font type = ?Courier new? / 12 pts.
Code To find the word ?Director?
Selection.Find.ClearFormatting
With Selection.Find
.Text = "DIRECTOR"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Can someone tell me how i could know if the word was found or not ?
When it is found it is automatically selected, so i can continue with Selection.find.execute.
Thanks for any reply.
I have to manipulate some data in a Word-document using VBA.
First i have to search for the word ?Director? in a document.
If i found it i should select from there till the rest of the document and set this selection with fonttype = ?Courier New? / 9pts
If i do not find it i should search for the word ?SIGNED?.
This word is always present in the document.
When i find it i should delete it and from there on till the end of the document i should set the font type = ?Courier new? / 12 pts.
Code To find the word ?Director?
Selection.Find.ClearFormatting
With Selection.Find
.Text = "DIRECTOR"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Can someone tell me how i could know if the word was found or not ?
When it is found it is automatically selected, so i can continue with Selection.find.execute.
Thanks for any reply.