Last Updated 3 July 2017
The following code allows bold text in a standard message box as well as standard features such as message box icons and more than one button.
You can also include context help items though I've never done so
The code uses the Eval function to format the first part of the code in BOLD text
Public 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
On Error GoTo Err_Handler
'Originally from http://www.trigeminal.com/usenet/usenet015.asp (now defunct)
FormattedMsgBox = Eval("MsgBox(""" & Prompt & """, " & Buttons & ", """ & title & """)")
MsgBox "Error " & Err.Number & " in FormattedMsgBox procedure : " & vbCrLf & " - " & Err.Description
FormattedMsgBox "You are not currently connected to the Internet " & _
"@Location map data cannot be downloaded " & vbCrLf & vbCrLf & _
"Please try again later @", vbCritical, "No Internet connection"
Functions can also be included in the message box text.
In this example, it is being used with a function GetLatestWebVersion:
FormattedMsgBox "Currency Exchange Rates Tracker version " & GetLatestWebVersion () & " is now available for download " & vbCrLf & _
"from the Mendip Data Systems website " & _
"@Click YES to close the program and download the latest version now " & vbCrLf & _
"Click NO if you want to download this later @", _
vbExclamation + vbYesNo, "New version available"
The formatted message box is included as one method of getting users' attention in my example Attention Seeking database.
The example app also includes other items such as customised message boxes and task dialog messages.
Colin Riddington Mendip Data Systems Last Updated 3 July 2017