Selectable Text in VBA Message Box Selectable Text in VBA Message Box vba vba

Selectable Text in VBA Message Box


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


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


If you want text that is "selectable" then don't use MsgBox. Use a Custom form and instead of a label use a textbox. However...

Change these properties of the textbox in design mode.

  1. SpecialEffect - fmiSpecialEffectFlat
  2. BackStyle - Transparent
  3. Locked - True

And then use this code

Option ExplicitPrivate Sub UserForm_Initialize()    Me.Caption = "Message Box"    TextBox1.Text = "Hello World!"End Sub

enter image description here