Microsoft KB Archive/162550

= How to Play a Sound Note Using Visual Basic for Applications =

Article ID: 162550

Article Last Modified on 10/10/2006

-

APPLIES TO


 * Microsoft Excel 95a
 * Microsoft Excel 95 Standard Edition
 * Microsoft Excel 5.0 Standard Edition
 * Microsoft Excel 5.0c
 * Microsoft Excel 5.0 for Macintosh
 * Microsoft Excel 5.0a for Macintosh

-



This article was previously published under Q162550



SUMMARY
This article describes how to insert a sound note into a cell and play the sound using a Microsoft Visual Basic for Applications macro procedure in the versions of Microsoft Excel listed above.

NOTE: Microsoft Excel 97 for Windows and Microsoft Excel 98 Macintosh Edition do not support sound notes.



MORE INFORMATION
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.  In a new workbook, click cell A1 on Sheet1 and click Note on the Insert menu. In the Cell Note dialog box, click Import.  Open a folder that contains a sound (.wav) file to play, and then click OK. The following sound files are typically installed by Windows or the Macintosh operating systems.      Operating system     Folder               File --

Windows 3.x         C:\Windows           Ding.wav Windows 95          C:\Windows\Media     Ding.wav Macintosh           System Briefcase     Quack  In the Cell Note dialog box, click Add, and then click OK.  In a new module sheet, type the following macro: ' Before running this macro you must insert a sound note into ' cell A1 on sheet1.

Sub PlaySound

' Insert a sound note into Cell A1. ' Test for sound capability. If Application.CanPlaySounds Then ' Play the SoundNote in cell A1. Worksheets("Sheet1").Range("A1").SoundNote.Play End If     End Sub  To run the macro, click Macro on the Tools menu, select PlaySound, and then click Run.</li></ol>

Additional query words: 5.00a 5.00c XL5 XL7 XL

Keywords: kbcode kbhowto kbprogramming KB162550

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.