Guus2005
01-21-2010, 11:32 PM
For some reason the old Access 97 (and earlier) message box disappered.
The text was divided into 3 sections, bold first followed by two normal sections. To use the three sections the text/prompt was separated by a @.
Here's a typical message:
msgbox("File not found.@Please locate the file first.@Press ok to continue",vbCritical,"Guus2005")
Alex Dybenko found a way to bring it back to life.
Enjoy!
Public Function MsgBox(Prompt As String, _
Optional Buttons As VbMsgBoxStyle = vbOKOnly, _
Optional Title As Variant = "", _
Optional HelpFile As Variant, _
Optional Context As Variant) As Variant
On Error Resume Next
If Nz(Title, "") = "" Then
Title = CurrentDb().Properties("AppTitle")
End If
On Error GoTo Err_MsgBox
If IsMissing(HelpFile) Or IsMissing(Context) Then
MsgBox = Eval("MsgBox(""" & Prompt & """, " & Buttons & ", """ & Title & """)")
Else
MsgBox = Eval("MsgBox(""" & Prompt & """, " & _
Buttons & ", """ & Title & """, """ & _
HelpFile & """, " & Context & ")")
End If
Exit_MsgBox:
Exit Function
Err_MsgBox:
MsgBox = VBA.MsgBox(Prompt, Buttons, Title)
GoTo Exit_MsgBox
End Function
Source: http://accessblog.net/2005/09/bring-back-access-97-msgbox.html
The text was divided into 3 sections, bold first followed by two normal sections. To use the three sections the text/prompt was separated by a @.
Here's a typical message:
msgbox("File not found.@Please locate the file first.@Press ok to continue",vbCritical,"Guus2005")
Alex Dybenko found a way to bring it back to life.
Enjoy!
Public Function MsgBox(Prompt As String, _
Optional Buttons As VbMsgBoxStyle = vbOKOnly, _
Optional Title As Variant = "", _
Optional HelpFile As Variant, _
Optional Context As Variant) As Variant
On Error Resume Next
If Nz(Title, "") = "" Then
Title = CurrentDb().Properties("AppTitle")
End If
On Error GoTo Err_MsgBox
If IsMissing(HelpFile) Or IsMissing(Context) Then
MsgBox = Eval("MsgBox(""" & Prompt & """, " & Buttons & ", """ & Title & """)")
Else
MsgBox = Eval("MsgBox(""" & Prompt & """, " & _
Buttons & ", """ & Title & """, """ & _
HelpFile & """, " & Context & ")")
End If
Exit_MsgBox:
Exit Function
Err_MsgBox:
MsgBox = VBA.MsgBox(Prompt, Buttons, Title)
GoTo Exit_MsgBox
End Function
Source: http://accessblog.net/2005/09/bring-back-access-97-msgbox.html