Office Sounds

G

Greg Maxey

Hi,

Several years ago I downloaded and installed a little program that generates
sounds when I perform some office funtions like Save, Print, etc.

If I click on OfficeMenu>Save or press CTRL+s the document is saved with an
accompanying chime.

I am trying to create that same effect using VBA with no success. I have
tried:

Sub Test1()
ActiveDocument.Saved = False
ActiveDocument.Save
End Sub

Sub Test2()
ActiveDocument.Saved = False
CommandBars.ExecuteMso ("FileSave")
End Sub

Both procedures do in fact save the document but the action isn't
accompanied by the chime.

Can this be done?

Thanks.
 
G

Greg Maxey

Duh! A work-a-round method is posted on my own website.

Option Explicit
Private Declare Sub PlaySound Lib "winmm.dll" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long)
Private Const SOUND_FILENAME = &H20000

Sub Test()
Dim sndFileName As String
If ActiveDocument.Saved = False Then
CommandBars.ExecuteMso ("FileSave")
sndFileName = "C:\WINDOWS\MEDIA\Office97\Complete.wav"
PlaySound sndFileName, 0&, SOUND_FILENAME
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top