I write lots of VBA applications in the course of my work. Often I use a msgbox() function, with buttons Yes, No, Cancel, to get a 3-way selection, e.g.,
Select case msgbox("Are you Hot (yes), Cold (no), or Lukewarm (cancel)", VBYesNoCancel)
case vbyes : <some code>
case vbno : <some code>
case vbcancel : <some code>
Trouble is, looping through a long document causes the message box to pop up dozens of times, severely annoying my co-workers and driving me crazy.
I know I can turn off the notification sound in the Control Panel. How about writing a little app that could be called from VBA, that would turn on/turn off the sound? My VBA code would then look like this:
x = shell ("c:\utils\soundoff.exe off")
< a little timer delay >
messgebox ( ) parsing
x = shell ("c:\utils\soundoff.exe on")
The shell function in VBA returns a value, 0 if no problem, or the program ID otherwise, which is why I have the dummy parameter variable x.
One can set/reset the sounds in the registry, but I wonder if it is tempting fate to write/rewrite the registry...
How about simply muting the speakers for a moment while the messgebox come up?
BTW I'm running Windows XP HE, but I have Vista and 98 also.