copy selected text to a variable

E

ents

Hi


how can I copy the selected text into a variable?

I have tried some come that uses the clipboard but it does not work




Set MyData = New DataObject
MyData.GetFromClipboard
strClip = MyData.GetText


Word does not know what to do with the Set command

Is there a way to copy the selected text into a variable without using
the clipboard
 
J

Jay Freedman

Sure. Try this:

strClip = Selection.Text

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

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