Centering the text in a message box

  • Thread starter Thread starter Rob_T
  • Start date Start date
R

Rob_T

Thanks for the replies. I might give the userform idea a try Jorge if
get the time (for now the simple message box will have to do).

Cheers,

Ro
 
hi, the only way i have found is to put a bunch of spaces
byfore the text,.
 
Hi, Rob
Take a look at this, brought by Paul Anthony (1998):

Function Msg(ParamArray parm())
For a = LBound(parm) To UBound(parm)
If Len(parm(a)) > max_len Then
max_len = Len(parm(a))
End If
Next a
For a = LBound(parm) To UBound(parm)
If Len(parm(a)) < max_len Then
spaces = (((max_len - Len(parm(a))) / 1.6))
For b = 1 To spaces
parm(a) = " " & parm(a) & " "
Next b
End If
msgstring = msgstring & parm(a) & Chr(10)
Next a
MsgBox msgstring
End Function
------
Sub test_message()
a = Msg("This first line is a lot bigger than", "this the second", _
"But not nearly as big as this line which I'll call the thrid line", _
"line 4 is small")
End Sub

Regards.
Jorge
 

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

Back
Top