PDA

View Full Version : Sleeper: The sound played upon displaying a msgbox



Regouin
06-06-2005, 12:05 AM
Is there any way I can influence the sound that is played upon displaying a msgbox. Because when i have a normal informative msgbox it plays a sound as if windows has encountered an error. I dont know if you have to play with the different types of msgboxes or if there is a special command that disables the sound.

TIA
Frank

Killian
06-06-2005, 01:51 AM
The sound associated with the VBA MsgBox is taken from the user's Windows sound settings (Critical Stop, Default Beep and Exclamation for vbCritical, vbQuestion and vbExclamation respectively, I think). There's no direct way of choosing to play the sound from VBA.
It sounds to me like you just need to specify your message as a vbInformation type to get the appropriate sound (see VBA Help file to see which argument to pass depending also on your button and icons choices)
If you want no sound when there is one set in Windows... there's the hard way and the easy way. Hard way: these settings are held in the windows registry, so you could find the appropriate key, store it, set it to nothing, show your message, set it back. (yes, it's a bit of a hack, and a fairly slow one).
Easy way: create a userform-based custom message function that behaves just how you want it to. (Could be quite useful function to have in your code-library)

Hope that helps

Regouin
06-06-2005, 01:54 AM
Ok, because I am using quite a few msgboxes just for information purposes. To confirm to the user that he or she changed certain settings or just to tell them whats happening. Everything save-related I already did via userforms cos then it shows during the saving and prevents the user from pressing buttons, I am going to play with it and let you know how I fare.