Problems with Macros in Powerpoint 2003

C

Christopher Bogart

Here's my goal:

I'm trying to create a slide in powerpoint that will have 2 separate
..wav files. I need one keyboard key to play one sound and the another
with another key.

I've downloaded the OfficeOne Shortcut Manager for PowerPoint
(http://officeone.mvps.org/ppsctmgr/ppsctmgr_download.html)

I create a blank slide. Insert the .wav file. Start the recording of the
macro, play the sound, then stop the recording. When I go to
Tools>Macros>Macros and try to run the macro I just created, it does
nothing.

I tried creating a shortcut key (ctrl+F8) under Tools>Customize shortcuts
When I go to Slide show>View show and press the shortcut key I get this
error.

Run-time error '-2147188160 (80048240)':

Application (unknown member): Invalid request. There is no currently
active document window.

Microsoft (http://support.microsoft.com/kb/285472) says to add code to
fix the problem. I don't know VB very well. Is there another way I can
accomplish what I want or is this a simple fix?

Many thanks in advance.
 
C

Christopher Bogart

I'm hoping someone can help. This is the code I've gotten with help from
David.

When I compile, it's being flagged on "sndFileName"

"iSuccess = PlaySound(sndFileName, 0&, SOUND_FILENAME)"

It says "Compile error. Invalid outside procedure"

Option Explicit

' ===== API declarations =====


Private Declare Function sndPlaySound Lib "winmm.dll" _
Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long

Private Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" _
(ByVal lpszName As String, _
ByVal hModule As Long, _
ByVal dwFlags As Long) As Long

' Sound Flag
Private Const SOUND_FILENAME = &H20000

Dim iSuccess As Integer
iSuccess = PlaySound(sndFileName, 0&, SOUND_FILENAME)
If iSuccess = 0 Then
PlaySoundFileB = False
Else
PlaySoundFileB = True
End If
End Function

Sub PlayMyFirstSound()
PlaySoundFileB ("C:\tpirding.wav")
End Sub

Sub PlayMySecondSound()
PlaySoundFileB ("C:\bell.wav")
End Sub
 
S

Steve Rindsberg

Christopher Bogart said:
I'm hoping someone can help. This is the code I've gotten with help from
David.

When I compile, it's being flagged on "sndFileName"

What you quote below isn't a full copy of what's on Shyam's site.
Suggest that you revisit it and copy all the code there, as is, for starters.
Then let us know what's up.
 

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