PDA

View Full Version : Solved: How I'll find a character position in a word document?



Grigoras
02-26-2008, 07:03 AM
Hi!I want to now the VBA code to find the first position of a character (@for example) in a word document. (document.@character) @ can be finded in many places , but I want to know position of the first @ in the document.

Thanks,:help

Tinbendr
02-26-2008, 08:19 AM
Sub FindCharacterPosition()
Dim MyRange As Range
Set MyRange = ActiveDocument.Range
MyRange.Find.Execute FindText:="@"
MsgBox "Position = " & MyRange.Start
End Sub

TonyJollans
02-26-2008, 08:23 AM
With ActiveDocument.Range
If .Find.Execute("@") Then MsgBox .Start
End With