Hi, I want to accomplish 2 thinks:
1) something like wordpossition=Activedocument.selection.words.possition
(and the possition of the word in the document is obtained)
of course the command is incorrect.
2) an if structure:
If the selected word is "-" and one word or character before the selected
word is a letter or a number (just letter or number, not "/" or "." or
anything) and one character after the selected word is " " then
..........................
end if
Thanks for your help
Greg Maxey - 13 Feb 2008 13:57 GMT
Something like this:
Sub Scratchmacro()
Dim oWord As Range
Dim oRng As Range
Set oRng = ActiveDocument.Range
Set oWord = Selection.Words(1)
oRng.End = oWord.End
MsgBox oRng.Words.Count
If oWord.Text = "- " Then
If oWord.Characters.First.Previous Like "[A-Za-z0-9]" Then
MsgBox "Bingo"
End If
End If
End Sub

Signature
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Greg Maxey - Word MVP
My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Hi, I want to accomplish 2 thinks:
>
[quoted text clipped - 12 lines]
>
> Thanks for your help
Klaus Linke - 14 Feb 2008 07:21 GMT
See also the reply to the message you've posted elsewhere.
Klaus