ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formatting text differently within a Msgbox (https://www.excelbanter.com/excel-programming/330500-formatting-text-differently-within-msgbox.html)

Linking to specific cells in pivot table

Formatting text differently within a Msgbox
 
Thanks to Herald for his previous help! I wanted to know if it was possible
to format text within a Msgbox differently -- ie -- the first line below I'd
like to have a font of 20 with the text bolded. The other lines I'd like to
have at a font of 12 with no bolded text. Is it possible to do this? Thanks!

MsgBox "INTERMOD CALC" & vbNewLine & _
" " & vbNewLine & _
"Spreadsheet creator: Robert" & vbNewLine & _
" " & vbNewLine & _
"Chief Project Advisor: Lisa" & vbNewLine & _
" " & vbNewLine & _
"Beta Testers: Richard, Lisa," & vbNewLine & _
"George, Kelly, Michael,"


William Benson

Formatting text differently within a Msgbox
 
I do not think you can change fonts and stuff of messagebox text. Maybe with
a Win API call, not through Excel. If you were to put these items in a cell,
yes, you could change a cell's appearance mid-cell.


Sub Macro4()
'Example turns any code after a linebreak to red size 14 bold
'Note: Need to define MyRange as something
'Also, this assumes only one linebreak, you would need
'Special parsing routine to change text in between more
'than one line break

Dim Cell As Range
For Each Cell In Selection
If InStr(Cell.Value, Chr(10)) 0 Then
With Cell.Characters _
(Start:=InStr(Cell.Value, Chr(10)) + 1, _
Length:=Len(Cell.Value) - _
InStr(Cell.Value, Chr(10))).Font
.Size = 14
.ColorIndex = 3
.Bold = True
End With
End If
Next Cell
End Sub




"Linking to specific cells in pivot table"
crosoft.com wrote in
message ...
Thanks to Herald for his previous help! I wanted to know if it was
possible
to format text within a Msgbox differently -- ie -- the first line below
I'd
like to have a font of 20 with the text bolded. The other lines I'd like
to
have at a font of 12 with no bolded text. Is it possible to do this?
Thanks!

MsgBox "INTERMOD CALC" & vbNewLine & _
" " & vbNewLine & _
"Spreadsheet creator: Robert" & vbNewLine & _
" " & vbNewLine & _
"Chief Project Advisor: Lisa" & vbNewLine & _
" " & vbNewLine & _
"Beta Testers: Richard, Lisa," & vbNewLine & _
"George, Kelly, Michael,"





All times are GMT +1. The time now is 12:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com