N
New to VBA
X-No-Archive: Yes
I have this macro that when the user selects a term or sentence in a
document, then
it pastes it to an external application and does its thing. The macro begins
with:
Dim Term As String
If Selection.Type = wdSelectionIP Then
Term = Selection.Words(1).Text
Else
Term = Selection.Text
End If
Term = Trim(Term)
'Open the external application, etc....
The problem is that if the selected text is at the end of a line or
paragraph
and includes the line or paragraph mark, then it pastes the term but the
macro stops running. If the selection does not include a paragraph mark, the
macro runs normally and works flawlessly.
What is the code not to include the paragraph mark in the selection (i.e.,
if the selected text
includes a paragrah mark, then move one space to the left)?
Thanks
I have this macro that when the user selects a term or sentence in a
document, then
it pastes it to an external application and does its thing. The macro begins
with:
Dim Term As String
If Selection.Type = wdSelectionIP Then
Term = Selection.Words(1).Text
Else
Term = Selection.Text
End If
Term = Trim(Term)
'Open the external application, etc....
The problem is that if the selected text is at the end of a line or
paragraph
and includes the line or paragraph mark, then it pastes the term but the
macro stops running. If the selection does not include a paragraph mark, the
macro runs normally and works flawlessly.
What is the code not to include the paragraph mark in the selection (i.e.,
if the selected text
includes a paragrah mark, then move one space to the left)?
Thanks