An interesting question. Fumei is right. MsgBox is basically just a wrapper for the MessageBox API of User32. But the nice thing to know is that the API determine it's sounds off of the sounds set in "Sounds And Audio" in the control panel. And those settings are store in the registry. So you could change the registry back and forth when message boxing.

Note1: A nice side effect is that you could set the entry to a .wav of your own instead of blank
Note2: The vbCritical message box and vbExclamation use different keys to determine sound. Shouldn't be to hard to figure out though
Note3: After a little more testing, this code seems to work, but I would break test it hard. I still don't have full confidence in it. So use at your own risk.


[vba]Option Explicit

Public Sub TestSilentBox()
'Written by Aaron Bush 4/24/2008
'Provided with no restriction as-is with no warranty express or implied.
'Tested only on Windows XP, not fully tested.
Const strScheme_c As String = "HKEY_CURRENT_USER\AppEvents\Schemes\"
Const strKeyDefaultSound_c As String = "HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\.Default\.Current\"
Dim wshl As Object
Dim orgVal As String
Dim orgScheme As String
Dim blnSafetyCheck As Boolean
On Error GoTo Err_Hnd
'Create Windows Script Host Shell Object:
Set wshl = CreateObject("WScript.Shell")
'Get value of registry key that indicates which sound scheme is in use:
orgScheme = wshl.RegRead(strScheme_c)
'Get value of registry key that indicates which sound is being used for default beep:
orgVal = wshl.RegRead(strKeyDefaultSound_c)
'Change the sound for default beep in in the "Current Scheme" to an empty
'string (another words no sound):
'(Current could also be thought of as "Custom".)
wshl.RegWrite strKeyDefaultSound_c, vbNullString, "REG_EXPAND_SZ"
'Change the key that indicates the sound scheme in use is Current/Custom:
wshl.RegWrite strScheme_c, ".current", "REG_SZ"
'Now that the default beep is turned off, use the message box:
MsgBox "Silent"
'Restore the original sound settings:
wshl.RegWrite strKeyDefaultSound_c, orgVal, "REG_EXPAND_SZ"
wshl.RegWrite strScheme_c, orgScheme, "REG_SZ"
'This is used to indicate the sound settings were restored:
blnSafetyCheck = True
'Give an example using the restored sound settings:
MsgBox "With Sound"
Exit_Proc:
On Error Resume Next
'Verify sound settings were restored and if not, attempt to restore them.
If Not blnSafetyCheck Then
If LenB(orgVal) Then 'Only try if you know the original value.
wshl.RegWrite strKeyDefaultSound_c, orgVal, "REG_EXPAND_SZ"
End If
If LenB(orgScheme) Then 'Only try if you know the original value.
wshl.RegWrite strScheme_c, orgScheme, "REG_SZ"
End If
End If
'Release Windows Script Host Shell Object:
Set wshl = Nothing
Exit Sub
'Handle Errors:
Err_Hnd:
MsgBox Err.Description, vbSystemModal, "Error: " & Err.Number
Resume Exit_Proc
End Sub
[/vba]