![]() |
msgbox title
Can I center the title of a msgbox?
D |
msgbox title
D
No built-in way that I know. This seems to work reasonably well Sub CenterMsgTitle() Dim sPrompt As String Dim sTitle As String sPrompt = "this is some long, long, long, text" sTitle = CenteredTitle("The Title", sPrompt) MsgBox sPrompt, , sTitle End Sub Function CenteredTitle(ByVal sTitle As String, _ ByVal sPrompt As String) As String Dim vLines As Variant Dim i As Long Dim lMaxLen As Long 'Title font is slightly larger than prompt font Const dFontScale As Double = 0.95 'Find the longest line of the message vLines = Split(sPrompt, vbNewLine) For i = LBound(vLines) To UBound(vLines) If Len(vLines(i)) lMaxLen Then lMaxLen = Len(vLines(i)) Next i 'Add spaces in front of the title CenteredTitle = Application.Rept(" ", lMaxLen / 2 * dFontScale) & sTitle End Function -- Dick Kusleika MVP - Excel Excel Blog - Daily Dose of Excel www.dicks-blog.com "dg" wrote in message ... Can I center the title of a msgbox? D |
msgbox title
Hi
AFAIK: No you can't -- Regards Frank Kabel Frankfurt, Germany "dg" schrieb im Newsbeitrag ... Can I center the title of a msgbox? D |
All times are GMT +1. The time now is 09:55 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com