Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Adding user's selected text as new item in listbox.
I am trying to create a macro that would take whatever text has been
highlighted in a Word Document by the user and then add it on the fly to a list box on a modeless form. The part that I am having trouble is somehow capturing the contents of the selected text so I can make mytext in the ListBox1.AddItem (mytext) be the highlighted text. I am lost at the present time trying to sort out using range and selection. If there is anyone who could help me with me, I would really appreciate it. Thanks! |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Adding user's selected text as new item in listbox.
Thanks, Jay, for taking the time to provide the info. I really appreciate
it. "Jay Freedman" wrote: On Sun, 21 Dec 2008 07:36:23 -0800, Joanne Christensen Joanne wrote: I am trying to create a macro that would take whatever text has been highlighted in a Word Document by the user and then add it on the fly to a list box on a modeless form. The part that I am having trouble is somehow capturing the contents of the selected text so I can make mytext in the ListBox1.AddItem (mytext) be the highlighted text. I am lost at the present time trying to sort out using range and selection. If there is anyone who could help me with me, I would really appreciate it. Thanks! The code you're looking for is mytext = Selection.Text ListBox1.AddItem mytext or, if you don't need to use the variable mytext for something else, simply use ListBox1.AddItem Selection.Text -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Adding an item at the end of each line | Microsoft Word Help | |||
Selected item doesn't automatically copy to clipboard | Microsoft Word Help | |||
Adding a Template to a Menu Item | Microsoft Word Help | |||
adding the user's name and date to the top of a document | Microsoft Word Help | |||
The first item in the drop-down list can't be selected? | Microsoft Word Help |