msg box programming

P

Peter

Hello,

I would like to code a command button that when pressed would display a
message box or another small window that will display some text. I have
programmed this successfully. What I need now, is the ability for a user to
copy and paste the text displayed in the msgbox to another part of the word
document.

Is this possible to do with a msgbox or any other control?

Thanks,
Peter
 
E

Ed

You'd probably have to use a UserForm which is shown vbModeless. That would
allow the user to scroll through the doc and place the insertion point where
the text should go. Then program the CommandButton to paste when clicked.

Ed
 
D

Doug Robbins - Word MVP

See the article "Manipulating the clipboard using VBA" at:

http://www.word.mvps.org/FAQs/MacrosVBA/ManipulateClipboard.htm

It contains a routine for getting the text from a string variable into the
clipboard (so that it can be pasted somewhere)


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
P

Peter

Thanks Doug,

How would you append to the clipboard or string variable? What I am doing is
displaying text in a yes/no msg box. If a user clicks "yes", it will send the
text to the clipboard. I will have about 7 msgboxes pop us one after another.
Can I somehow append the text from every msgbox that is answered "yes" by the
user into one string variable that will then be sent to the clipboard?

Or is there an easier way of doing this through another control?

Thanks,
Peter
 
D

Doug Robbins - Word MVP

I would suggest that you have the strings displayed in a listbox on a
userform and then build a string from the ones that are selected.

See the article "How to create a Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm

and "How to find out which Items are selected in a Multi-Select ListBox" at:

http://www.word.mvps.org/FAQs/Userforms/GetMultiSelectValues.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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