PDA

View Full Version : [SOLVED:] MsgBox text...bold???



malik641
09-16-2005, 01:49 PM
Can you create a MsgBox and set certain text to be bold???

Example:


Sub Msg()
MsgBox "The next line will be bold" & vbCrLf & "This line is bolded", vbOKOnly,"Bold???"
End Sub

I don't really want to create a userform for something so little.

Thanks in advance :thumb

Sir Phoenix
09-16-2005, 01:52 PM
I'd think not for a message box, since it treats the whole thing as one String?

MWE
09-16-2005, 02:32 PM
Can you create a MsgBox and set certain text to be bold???

Example:


Sub Msg()
MsgBox "The next line will be bold" & vbCrLf & "This line is bolded", vbOKOnly,"Bold???"
End Sub

I don't really want to create a userform for something so little.

Thanks in advance :thumb
you have very little direct control over how MsgBox displays things. I have found a way to change font, size, bold, etc., but it is quite complicated and time consuming (lots of class modules and messy stuff). It actually takes about 6 seconds from the time you start the process until the text is displayed.

I know you do not like the idea, but a better approach is to create your own version of MsgBox using a UserForm. You can make it look very similar to the normal message box and can then control everything. I am sure that there are examples of such userforms floating around (mine is a mess).

FYI: MsgBox also has a limit on the number of characters that can be displayed. It is around 1024, but actually depends on what characters are displayed. There is a KB for an improved version of MsgBox (http://vbaexpress.com/kb/getarticle.php?kb_id=703) that does not have this limitation.

malik641
09-16-2005, 04:26 PM
I guess I'll just stick to what I have. And if it becomes important enough, then I'll make a userform for it.

Thanks for the info MWE :thumb Just what I was lookin' for.