Assigning text to variable

S

Sasa

Hello,
I was wondering how should I assing some selected text (in
document) to some predefined string variable.

I have selected text using code:

Selection.Words(1).Select

How can I assign it to variable.
Regards.

Sasa
 
H

Helmut Weber

Dim MyStr as string
....
Selection.Words(1).Select
MyStr = selection.text ' or shorter
MyStr = Selection.Words(1)
and
mystr = trim(mystr) to cut off a possible existing
trailing space character.
Helmut Weber
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top