Making Windows Beep Using VBA

This article has been archived. It is offered "as is" and will no longer be updated.
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 LongPrivate 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: 01/03/2015 21:09:00 - Revision: 5.0

  • 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
  • kbnosurvey kbarchive kbmbsmigrate KB871663
Feedback