selvamarcadu
Member
- Joined
- Jul 7, 2009
- Messages
- 17
- Programming Experience
- Beginner
Hi,
I am using dsoframer activex control to embed MS Office files(doc,xls,ppt).Now i want to highlight certain keywords and use the following code,
<code>
Dim oDoc As Word.Document
oDoc = AxFramerControl1.ActiveDocument
oDoc.ActiveWindow.Selection.Find.ClearFormatting()
With oDoc.ActiveWindow.Selection.Find
.Text = "sample"
.Forward = True
.Wrap = WdFindWrap.wdFindContinue
'.Wrap = WdFindWrap.wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
oDoc.ActiveWindow.Selection.Find.Execute()
</code>
But it highlights the first match only.Any idea on this?
Note: I obtained the code with the help of macro,but it does not generate the highlight all code from MS Word.So i used Find.Execute().
Thanks
Selvam
I am using dsoframer activex control to embed MS Office files(doc,xls,ppt).Now i want to highlight certain keywords and use the following code,
<code>
Dim oDoc As Word.Document
oDoc = AxFramerControl1.ActiveDocument
oDoc.ActiveWindow.Selection.Find.ClearFormatting()
With oDoc.ActiveWindow.Selection.Find
.Text = "sample"
.Forward = True
.Wrap = WdFindWrap.wdFindContinue
'.Wrap = WdFindWrap.wdFindAsk
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
oDoc.ActiveWindow.Selection.Find.Execute()
</code>
But it highlights the first match only.Any idea on this?
Note: I obtained the code with the help of macro,but it does not generate the highlight all code from MS Word.So i used Find.Execute().
Thanks
Selvam