PDA

View Full Version : MsgBox



blackie42
10-06-2007, 04:35 AM
How do you make the script in a message box bold or capitalized?

Maybe even make it one word over another e.g.

DETAILS
ADDED

Rather than 'details added'

thanks for your help

Jon

tpoynton
10-06-2007, 05:20 AM
I'm not sure about formatting as bold, italic, etc.

to do as you describe above (untested):


msgbox ("DETAILS" & vbnewline & "ADDED")

lucas
10-06-2007, 08:09 AM
You would be better off using a userform. If you care that much about how it looks then you shouldn't be using an ugly msgbox anyway.....

blackie42
10-06-2007, 08:16 AM
Nah its a message box within a userform - just tells the user that certain items have been added to multiple sheets.

thanks

lucas
10-06-2007, 08:22 AM
Still....if you want to format the text, etc. you could use a small userform set up the way you like and just have an ok button to dismiss it. Trying to get msgbox to look like a userform is more trouble than it's worth.

Bob Phillips
10-06-2007, 08:57 AM
May I add a word of caution. I have done what Steve has suggested in previous apps, and it was more effort than it was worth. I created a generic MsgBox class, but catering for all possible buttons, all defaults, the key defaults, and so on, was a lot of work, just to get it different?

lucas
10-06-2007, 09:17 AM
I agree Bob, but if the user only needed to call the message once and insisted on formatting.....it can be done without the complexity of a class file...either way it seems like a lot of extra work, maint., etc. just for a different look.

Bob Phillips
10-06-2007, 10:08 AM
True Steve, but if you want all of the default functionality, you have to build it yourself.

Norie
10-06-2007, 10:38 AM
a message box within a userform
What is that exactly?:bug:

lucas
10-06-2007, 10:50 AM
Hi Norie,
The op wanted to format a msgbox so we can be pretty sure he doesn't understand the nomenclature of the language. Pretty sure he means called from a userform....but I understand your :104:

Cyberdude
10-06-2007, 12:32 PM
To address the original question, you can use the following to make one word over another (as has already been suggested):
Msgbox "DATAILS" & vbCR & "ADDED" which takes care of capitalization and word-over-word.

However, italicizing, underscoring, etc. can't be done because you are using Msgbox in VBA and VBA doesn't accommodate that kind of text formating. Actually, neither does Msgbox itself.

blackie42
10-06-2007, 03:12 PM
well vbnewline don't seem to work anyway - and yes I'm a newbie but learnin lots as I go along.

great board this - ideas bouncin round left right & centre

regards
Jon

Bob Phillips
10-06-2007, 03:23 PM
vbNewline should work!

tpoynton
10-06-2007, 08:18 PM
if something doesnt work, post the code and the error message so folks can help!

daniel_d_n_r
10-06-2007, 10:39 PM
vbcrlf

this should take a new line, why not use a userform with a label
you can format label text and you can put what ever you want in it with a variable

somthing like

x = Label1.text

blackie42
10-07-2007, 03:27 AM
The message box is confirming when user has actioned the contents of a userform :

MsgBox "DETAILS ENTERED FOR CLIENT: " & AddEntry.txtName & ", & PLAN: " & AddEntry.txtPlan AddEntry.txtPlan = ""

Just wanted the 3 text messages on different lines in bold.

cheers

Bob Phillips
10-07-2007, 03:34 AM
Not bold, but over 2 lines no problem



MsgBox "DETAILS ENTERED FOR CLIENT: " & AddEntry.txtname & vbNewLine & _
"PLAN: " & AddEntry.txtplan