MsgBox

M

Mary

Is there a way to code certain characters or words of a
message with attributes (bold, color, font, etc)
different from other characters or words in the same
message? Or does one attribute fit all, with no options?

Thanks,
Mary
 
M

Mark Phillipson

Hi Mary,

There is a way to get the first line bold by calling the following function
insead of MsgBox:

Function FormattedMsgBox( _
Prompt As String, _
Optional buttons As VbMsgBoxStyle = vbOKOnly, _
Optional Title As String = vbNullString, _
Optional HelpFile As Variant, _
Optional Context As Variant) _
As VbMsgBoxResult

If IsMissing(HelpFile) Or IsMissing(Context) Then
FormattedMsgBox = Eval("MsgBox(""" & Prompt & _
""", " & buttons & ", """ & Title & """)")
Else
FormattedMsgBox = Eval("MsgBox(""" & Prompt & _
""", " & buttons & ", """ & Title & """, """ & _
HelpFile & """, " & Context & ")")
End If
End Function
Function FormattedMsgBox( _
Prompt As String, _
Optional buttons As VbMsgBoxStyle = vbOKOnly, _
Optional Title As String = vbNullString, _
Optional HelpFile As Variant, _
Optional Context As Variant) _
As VbMsgBoxResult

If IsMissing(HelpFile) Or IsMissing(Context) Then
FormattedMsgBox = Eval("MsgBox(""" & Prompt & _
""", " & buttons & ", """ & Title & """)")
Else
FormattedMsgBox = Eval("MsgBox(""" & Prompt & _
""", " & buttons & ", """ & Title & """, """ & _
HelpFile & """, " & Context & ")")
End If
End Function

The Eval function forces the function to run in Access and not VBA.

You can also create a custom form for the purpose as I have done - see the
Utilities Add-In at
http://mphillipson.users.btopenworld.com/

HTH
--

Cheers
Mark

Free Access/Office Add-Ins at:
http://mphillipson.users.btopenworld.com/
 
M

Mary

Thanks. That appears to be what I need.



-----Original Message-----
Hi Mary,

There is a way to get the first line bold by calling the following function
insead of MsgBox:

Function FormattedMsgBox( _
Prompt As String, _
Optional buttons As VbMsgBoxStyle = vbOKOnly, _
Optional Title As String = vbNullString, _
Optional HelpFile As Variant, _
Optional Context As Variant) _
As VbMsgBoxResult

If IsMissing(HelpFile) Or IsMissing(Context) Then
FormattedMsgBox = Eval("MsgBox(""" & Prompt & _
""", " & buttons & ", """ & Title & """)")
Else
FormattedMsgBox = Eval("MsgBox(""" & Prompt & _
""", " & buttons & ", """ & Title & """, """ & _
HelpFile & """, " & Context & ")")
End If
End Function
Function FormattedMsgBox( _
Prompt As String, _
Optional buttons As VbMsgBoxStyle = vbOKOnly, _
Optional Title As String = vbNullString, _
Optional HelpFile As Variant, _
Optional Context As Variant) _
As VbMsgBoxResult

If IsMissing(HelpFile) Or IsMissing(Context) Then
FormattedMsgBox = Eval("MsgBox(""" & Prompt & _
""", " & buttons & ", """ & Title & """)")
Else
FormattedMsgBox = Eval("MsgBox(""" & Prompt & _
""", " & buttons & ", """ & Title & """, """ & _
HelpFile & """, " & Context & ")")
End If
End Function

The Eval function forces the function to run in Access and not VBA.

You can also create a custom form for the purpose as I have done - see the
Utilities Add-In at
http://mphillipson.users.btopenworld.com/

HTH
--

Cheers
Mark

Free Access/Office Add-Ins at:
http://mphillipson.users.btopenworld.com/






.
 

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