MSGBOX - Formatting text

G

Guest

How can I format text within a MSGBOX. I want to BOLD a word inside the
message box so it stands out when the Message box is displayed.
 
G

Guest

Hi,
you can not do this with the standard message box. Just create a form which
looks like you want your message box to look. Then call this form instead on
whatever events you want to use it.
HTH
Good luck
 
G

Guest

You can't format the text within a MSGBOX function, but i will show you
something else, that use the MSGBOX function.

There are 2 function AccessMsgBox and Enquote.(The last one is used within
the first one)

'This calls the Access message box instead of to the VBA one.
'The Access input box supports Windows XP theming and bold
' message strings by using the following notation:
' Example : AccessMsgBox "Text that will be bold. @Next line. @"

Function AccessMsgBox(Prompt As String, Optional Buttons As VbMsgBoxStyle =
vbOKOnly, Optional Title As String, Optional HelpFile As String = "",
Optional Context As Long = 0, Optional AcApp As Access.Application) As
VbMsgBoxResult

If AcApp Is Nothing Then Set AcApp = Application

' Build the MsgBox expression
Dim strExpr As String
strExpr = "MsgBox(" & Enquote(Prompt) & _
", " & Buttons & _
IIf(Title = "", "", ", " & Enquote(CStr(Title)) & _
IIf(HelpFile = "", "", ", " & Enquote(HelpFile) & ",
" & Context)) & _
")"
' Evaluate it
AccessMsgBox = AcApp.Eval(strExpr)
End Function

Here is the Enquote function:
Function Enquote(strText As String) As String
Enquote = """" & Replace(strText, """", """""") & """"
End Function

Have fun :)
 

Ask a Question

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.

Ask a Question

Top