Expand a message box?

bgill

New Member
Joined
Aug 22, 2002
Messages
33
I have a message box with text in it to provide instructions to the user. The box is too small and all of the text does not show. Can I make it bigger?

I have never used the buttons and message boxes before and just figured this out on my own by modifying some instructions I found in various searches. Please assume I know nothing about VBA!

Thank you.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
You can split your message into multiple lines:

Code:
MsgBox "line 1" & vbNewLine & "line 2" & vbNewLine & "line 3"
 
Upvote 0
Yes I think so (255 lines?). You can build your message then display it like this

Code:
msg = "line 1" & vbNewLine & "line 2" & vbNewLine & "line 3"
msg = msg & vbNewLine & "line 1" & vbNewLine & "line 2" & vbNewLine & "line 3"
MsgBox msg

However, there may also be a character limit (1024?).

Perhaps you should consider displaying a userform with a multi-line textbox (32,000 character limit).
 
Upvote 0
Thank you for the suggestion. I can't figure that out either so I will find another way to do what I want.

Thanks again.
 
Upvote 0
Maybe create a sheet (call it say "Info")
with a TextBox containing your instructions. The character limit I believe is enormous and you can format it as you wish (bold etc. which you cannot do with a message box").


Underneath that place a button from the Controls toolbar with the code

Code:
Private Sub CommandButton1_Click()
Me.Visible = xlSheetHidden
End Sub

Then in the ThisWorkbook module

Code:
Private Sub Workbook_Open()
With Sheets("Info")
    .Visible = xlSheetVisible
    .Select
End With
End Sub
 
Upvote 0
Stick the below in a Module and run it. You might get the idea then

Code:
Sub bgilltest()

MsgBox "I have a message box with text in it to provide " & vbCr & "instructions to the user. The box" & vbCr & _
"is too small and all of the " & vbCr & "text does not show." _
& vbCr & "" & vbCr & "Can I make it bigger?"
 
End Sub


I used vbCR but VOG's vbNewLine also works.
 
Upvote 0
With all due respect for VoG's comments on the character limit (1024)

I also notice that there seems to be a Width Limit for Message boxes.

With this test:
Code:
Sub bgilltest()

MsgBox "I have a message box with text in it to provide instructions to the user. The box is too" & vbCr & _
"small and all of the text does not show."

End Sub

The messabe box comes up with the first carriage return after the word The. Then there is the CR after too, which is in the code. Producing three lines in the Box.

Don't know how long or how much info you are trying to get into the Box. But if you don't mind chopping it up with CR's you have that solution.

Or you can go with what VoG suggested, creating another Sheet or using a UserForm.
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top