Microsoft Knowledge Base Email Alertz

(213777) - In Microsoft Excel 2000, cell notes have been replaced with cell comments and sound notes are no longer supported. However, you can use a Microsoft Visual Basic for Applications procedure to play sounds. To play a sound in a Visual Basic for...

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 213777 - Last Review: November 23, 2006 - Revision: 3.5

XL2000: How to Play Sounds Using Visual Basic for Applications

This article was previously published under Q213777

SUMMARY

In Microsoft Excel 2000, cell notes have been replaced with cell comments and sound notes are no longer supported. However, you can use a Microsoft Visual Basic for Applications procedure to play sounds. To play a sound in a Visual Basic for Applications procedure, a Microsoft Windows application programming interface (API) function sndPlaySound32() can be used to play a wave (.wav) file.

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals 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 needs.
If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites:

Microsoft Certified Partners - https://partner.microsoft.com/global/30000104 (https://partner.microsoft.com/global/30000104)

Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice (http://support.microsoft.com/gp/advisoryservice)

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS (http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms)
NOTE: The following sample macro makes calls to the Windows API. This type of programming is supported by the Windows Software Development Kit (SDK) and the Visual Basic Professional Edition support groups. The level of support that you can receive from these groups depends on the individual support policies of the group. (Microsoft Support Engineers may not be able to assist in specific construction of macros that use API programming.) If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including the creation of custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400.

To use the macro, type the following declaration and subprocedure into a module sheet. Run the PlaySound macro to hear the chimes .wav file.
'This function declaration must be entered onto a single line.
Declare Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" _
    (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long


Sub PlaySound()
    If Application.CanPlaySounds Then
        'Substitute the path and filename of the sound you want to play
        Call sndPlaySound32("c:\windows\media\chimes.wav", 0)
    End If
End Sub
				
You can replace C:\windows\media\chimes.wav with any valid .wav file.

REFERENCES

For additional information about comments in cells, click the article number below to view the article in the Microsoft Knowledge Base:
213244  (http://kbalertz.com/Feedback.aspx?kbNumber=213244/EN-US/ ) XL2000: Sounds Not Converted with Cell Notes

APPLIES TO
  • Microsoft Excel 2000 Standard Edition
Keywords: 
kbdtacode kbhowto kbinfo kbprogramming KB213777
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate