DonationCoder.com Software > Post New Requests Here
Silent msgbox() popup in VBA for Word
(1/1)
hgondalf:
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>
end select
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.
Thanks!
AbteriX:
One can set/reset the sounds in the registry, but I wonder if it is tempting fate to write/rewrite the registry...-hgondalf (May 06, 2010, 09:08 AM)
--- End quote ---
What do you think how those other tools would do this?
x = shell ("c:\utils\soundoff.exe off")-hgondalf (May 06, 2010, 09:08 AM)
--- End quote ---
If you want an external tool you can try something like NirSoft NirCMD
http://www.nirsoft.net/utils/nircmd.html
* freeware
* stand alone/portable
Examples:
Mute the system volume nircmd.exe mutesysvolume 1
Unmute the system volume nircmd.exe mutesysvolume 0
Switch the system volume between the mute and normal state. nircmd.exe mutesysvolume 2
Navigation
[0] Message Index
Go to full version