How to Assign Sounds to Word for Windows Commands

Last reviewed: July 30, 1997
Article ID: Q100047
The information in this article applies to:
  • Microsoft Word for Windows, versions 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c
  • Microsoft Windows operating system version 3.1

SUMMARY

If your machine is capable of playing sounds, you can assign sounds to a Word for Windows command by modifying the macro for that command.

WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this macro code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

MORE INFORMATION

To assign a .WAV sound file to a Word command, add the Windows API SndPlaySound function call and the name of the .WAV file to the macro for that command. When you execute the command, Word plays the .WAV file.

For example, change the EditPaste command as shown below to assign the JETS.WAV sound file to that command. This sample macro assumes that the JETS.WAV sound file is located in the Windows program directory (which is on drive C and is called WINDOWS).

Declare Function SndPlaySound Lib "MMSYSTEM"(File$, sFlag as Integer)\
as Integer

Sub Main
x = SndPlaySound("c:\windows\jets.wav", 1) Super EditPaste
End Sub

For more information on playing .WAV sound files from Word, query on the following words in the Microsoft Knowledge Base:

   WAV and play and sound and winword

Reference(s):

"User's Guide," version 2.0, pages 784-786


KBCategory: kbmacro kbhowto
KBSubcategory:
Additional query words: marketing 2.0 2.0a 2.0a-CD winword2
2.0b 2.0c winword
Version : 2.0 2.0a 2.0a-CD 2.0b 2.0c


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.