Making Windows Beep Using VBA

Article ID: 871663 - View products that this article applies to.
Expand all | Collapse all

TechKnowledge Content

Question
Can VBA be used to make a window beep?

Answer
Add the window where you want this to occur on to your VBA project and then paste the following code in its code window.

Adjust the parameters (frequency,length in milliseconds) to desired results.
Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long


Private Sub Window_AfterOpen()
Dim result As Long
result = Beep(1000, 200)
End Sub>

This article was TechKnowledge Document ID: 18609

Properties

Article ID: 871663 - Last Review: July 14, 2012 - Revision: 4.0
Applies to
  • Microsoft Dynamics GP 9.0
  • Microsoft Business Solutions–Great Plains 8.0
  • Microsoft Business Solutions–Great Plains 7.5
  • Microsoft Great Plains Dynamics 7.0
  • Microsoft Great Plains eEnterprise 7.0
  • Great Plains Dynamics 6.0
  • Great Plains eEnterprise 6.0
  • Modifier with Visual Basic for Applications
Keywords: 
kbmbsmigrate KB871663

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com