MsgBox

  • Thread starter Thread starter Mary
  • Start date Start date
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
 
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/
 
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/






.
 
Back
Top