C
Charles Tam
I would like to display Bolded strings on a message box.
I would like to display Bolded strings on a message box.
One additional question to this, Is it possible to change the color of any
of the line, like If I want to keep the first line Font Color Red and bold
Second line Blue font and Bold
Third line Black font and normal font.
Hi, Charles.
If you have Access 97, that's easy because the Access MsgBox( ) function is
called, which allows bold text along with normal text. In subsequent
versions of Access the VBA MsgBox( ) function is called, which doesn't allow
this functionality. However, the Access MsgBox( ) function can be forced to
be used instead of the VBA MsgBox( ) function by using the Eval( ) function.
The syntax is a little tricky, though. For example (watch out for word wrap):
' * * * * Start code * * * *
Dim sMsg As String
Dim sTitle As String
sMsg = "This is the 1st line in bold type.@This is the 2nd line.@This is
the 3rd line."
sTitle = "This Is The Title"
Eval ("MsgBox(""" & sMsg & """, " & vbOKOnly + vbExclamation & _
", """ & sTitle & """)")
' * * * * End code * * * *
Only the first line will be in bold type. The second and third lines will
not. If you'd like multiple lines in bold type, then add the vbCrLf constant
between these lines. For example:
sMsg = "This is the 1st line in bold type." & vbCrLf & _
"This is the 2nd line in bold type.@This is the 3rd line.@This is
the 4th line."
If you only want bold type and not normal type, then the following would work:
sMsg = "This is the 1st line in bold type." & vbCrLf & _
"This is the 2nd line in bold type.@@ "
There must be at least one character (in this case, a space) after the
second @ sign in order for the text before the @@ to be in bold type.
HTH.
Gunny
See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.
(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)
Beware to those who use munged addresses: known newsgroup E-mail harvesters
for spammers are (e-mail address removed) and (e-mail address removed)
- - -
When you see correct answers to your question posted in Microsoft's Online
Community, please sign in to the Community and mark these posts as "Answers,"
so that all may benefit by filtering on "Answered questions" and quickly
finding the right answers to similar questions. Remember that the first and
best answers are often given to those who have a history of rewarding the
contributors who have taken the time to answer questions correctly.
On the same line, how do I bold a word or two but not the entire line?
I would like to display Bolded strings on a message box.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.