![]() |
|
|
|
#1
|
||||
|
||||
|
I have noticed this phenomenon and I cannot readily explain it, but you can work around it:
Code:
Dim oRng As Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Font.Bold = True
.Text = Selection.Text
.Forward = True
.Wrap = wdFindStop
.Format = True
Do While .Execute
If oRng.Start = Selection.Start Then
oRng.Text = "<start>" & oRng.Text & "<end>"
Exit Do
End If
Loop
End With
Code:
Dim oRng As Range
Set oRng = ActiveDocument.Range
With oRng.Find
Do While .Execute(FindText:=Selection.Text)
If oRng.Start = Selection.Start Then
oRng.Text = "<start>" & oRng.Text & "<end>"
Exit Do
End If
Loop
End With
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#2
|
|||
|
|||
|
Hi Grahman,
Thanks for your code, it - of course - works. You wrote you Quote:
If there is an explanation, a link would be enough. I'd really like to unerstand what happens. BTW: do you know if this phenomenon only occurs with .FONT properties? Thanks again NP |
|
#3
|
|||
|
|||
|
Ooops,
your sent another post during my typing ... Basically I know your 'How To Search Site', but as it's the first time (for me) a oRng.Find procedure failed, I'm still a bit puzzled. It seems to be illogical somehow - for me. But I'll work it out. Cheers NP |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Onenote 2013 search is not identifying search terms correctly | Delta223 | OneNote | 0 | 08-12-2014 06:40 AM |
| Search for date and then apply mutliple search criteria in huge dataset | maxtymo | Excel | 2 | 12-01-2013 04:52 AM |
| Looking for Windows Search app with ability to search by content | gopher_everett | Office | 1 | 02-28-2013 09:23 PM |
| Search Function Problem | MageWind | Excel | 2 | 06-29-2011 09:46 AM |
Windows explorer search problem...help!!
|
NewSysAdmin | Windows | 1 | 03-08-2011 05:33 PM |