Playsound

<< Click to Display Table of Contents >>

 

Playsound

Playsound(FileName)

Plays a sound file whose path and name are indicated in the FileName parameter. This file must follow these specifications:

It must be in a Windows sound format (.wav extension)

If this file is in a project (added using the Insert resource option), its name must be enclosed in brackets

If a folder was created on a project and this file was added using the Insert resource option, this path must be enclosed in quotation marks (for example, "c:\sound\ding.wav"). If this file is on a local directory, its name does not need to be enclosed in quotation marks, it is enough to type a path (for example, c:\sound\ding.wav).

 

Example:

Sub InitialScreen_OnAlarm()
  ' If there is an active alarm, an alert sound is played.
  ' When this alarm is recognized, sound stops.
  Set Alarm = Application._
    GetObject("AlarmConfig1.Area1.AlarmSource1")
    If Alarm.ActiveNACKAlarms = True Then
      Application.PlaySound("[ringin.wav]")
  End If
End Sub

Was this page useful?