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.
 
Top