Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selectable Text in VBA Message Box

When I create a msgbox in VBA, the user cannot interact with the text at all. In my case, I want the user to be able to highlight and copy the text. I'm thinking the better way to do this may be to add a button that copies the text to the clipboard. Any suggestions?

like image 630
nobillygreen Avatar asked Aug 30 '12 01:08

nobillygreen


People also ask

How do I escape VBA code?

Escape Character in VBA In programming languages “\” — a backslash — is generally used as an escape character. Example : \n for newline, \t for tab space. But in VBA, we use a function named “chr()”. This in-built function returns the ASCII equivalent value of the parameter.


2 Answers

For this code:

msgbox "Does Control+C work on a lowly, old message box?" 

you can press ctrl + c, open notepad, ctrl + v and you will get this:

--------------------------- Microsoft Excel --------------------------- Does Control+C work on a lowly, old message box? --------------------------- OK    --------------------------- 
like image 134
ray Avatar answered Oct 02 '22 14:10

ray


You can use an inputbox instead of a message box

inputbox "Copy the below text", "Copy Text", "Text value" 

inputbox copy text

enter image description here

like image 43
najeem Avatar answered Oct 02 '22 13:10

najeem