Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default msgbox title

Can I center the title of a msgbox?

D
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to hide a chart title, but keep the title in the chart KBratt Charts and Charting in Excel 1 July 16th 09 12:13 AM
Named range=Column title,comumn title in cellB6 use B6in equation Graham Excel Discussion (Misc queries) 2 July 21st 06 10:03 AM
Show full path title in title bar? Nor New Users to Excel 4 November 4th 05 06:00 PM
Pasting Objects into Chart title and Axis title Sam Charts and Charting in Excel 1 June 6th 05 08:50 PM
Msgbox Wildman Excel Worksheet Functions 1 April 26th 05 04:57 AM


All times are GMT +1. The time now is 08:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"