MsgBox

  • Thread starter Thread starter Froto
  • Start date Start date
F

Froto

I would like to know if it is possible to change the font
size and color for a msgbox message through code.

Thank you for the help
 
I would like to know if it is possible to change the font
size and color for a msgbox message through code.

Thank you for the help

You can do it manually, but only if you change the message box font
and color for all Windows applications.
It will be in the Desktop Properties.
Properties + Appearance + Advanced

I suggest you make your own unbound form to display messages. You can
format it however you wish. Add a command button to the Form. Code
it's click event:
Me.Visible = False

Open the form when needed using:
DoCmd.OpenForm, , , , , acDialog

Then add:
DoCmd.Close acForm, "MessageFormName"
to close it.
Please respond only to this newsgroup.
I do not reply to personal email
 
I got this reponse from Graham:


Public Function FMsgBox(sLine1 As String, sLine2 As String, _
sLine3 As String, Optional lButtons As VbMsgBoxStyle = vbOKOnly, _
Optional sTitle As String = vbNullString, Optional HelpFile As Variant,
_
Optional Context As Variant) As VbMsgBoxResult
'
'Description: This function creates a formatted MsgBox
' similar to that which was available in Access 97 and
' earlier versions.
'
'Inputs: sLine1: The first line of text to be displayed.
' sLine2: The second line of text to be displayed.
' sLine3: The third line of text to be displayed.
' lButtons: The buttons to be displayed (exposed
' as a vbMsgBoxStyle enum).
' Title: The (optional) MsgBox title.
' HelpFile: The (optional) help filename.
' If HelpFile is supplied, then Context
' must also be supplied.
' Context: The (optional) context or topic ID.
'
'Outputs: The standard MsgBox return value.

Dim sPrompt As String

'All three lines must exist
If Len(sLine1) > 1 And Len(sLine2) > 0 And Len(sLine3) > 0 Then
sPrompt = sLine1 & "@" & sLine2 & "@" & sLine3

If IsMissing(HelpFile) Or IsMissing(Context) Then
FMsgBox = Eval("MsgBox(""" & sPrompt & """, " _
& lButtons & ", """ & sTitle & """)")
Else
FMsgBox = Eval("MsgBox(""" & sPrompt & """, " _
& lButtons & ", """ & sTitle & """, """ _
& HelpFile & """, " & Context & ")")
End If
Else
DoCmd.Beep
MsgBox "You must supply all three lines.", _
vbOKOnly + vbExclamation, "Argument missing"
End If
End Function

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Back
Top