Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can I center the title of a msgbox?
D |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
AFAIK: No you can't -- Regards Frank Kabel Frankfurt, Germany "dg" schrieb im Newsbeitrag ... Can I center the title of a msgbox? D |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to hide a chart title, but keep the title in the chart | Charts and Charting in Excel | |||
Named range=Column title,comumn title in cellB6 use B6in equation | Excel Discussion (Misc queries) | |||
Show full path title in title bar? | New Users to Excel | |||
Pasting Objects into Chart title and Axis title | Charts and Charting in Excel | |||
Msgbox | Excel Worksheet Functions |