MESSAGEBOX

imported_unknown

Active Member
Joined
Jan 13, 2002
Messages
424
Is it possible when using a messagebox that the message is in the center and not all to the left? Hope someone can help me. Thanks.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Joe Was

MrExcel MVP
Joined
Feb 19, 2002
Messages
7,539
The MsgBox does not accept the "xlCenter" property. To center you will need to pad your lines with spaces and returns, like:

Sub myMsg()
MsgBox " Nice!" & Chr(13) & " Work!"

End Sub

Hope this helps. JSW

P.S. The board may have removed the displayed spaces from the code above.
This message was edited by Joe Was on 2002-10-03 18:21
 

ylijohe

Board Regular
Joined
Sep 6, 2002
Messages
58
You mean like this?

Sub myMsg() 
MsgBox "                  Nice!                   " & Chr(13) & "                    Work!                        " 

End Sub 
 

Joe Was

MrExcel MVP
Joined
Feb 19, 2002
Messages
7,539
Yes and no, your leading spaces yes, your trailing spaces no, adding trailing spaces just enlarges the box. JSW
 

Forum statistics

Threads
1,144,274
Messages
5,723,447
Members
422,497
Latest member
dougy99

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
Top