Slide ID in macro

S

smullins

I am writing a simple macro so that I can click on a pause button when
presenting a presentation to pause the embeeded Flash object during
presentation.

I have been able to write the macro in the slide.. but when I copy the slide
and place it in any other presentation the action settings on the icons loose
the reference to the macro. Can anyone help me do one of two things?

1) Fix the action settings automatically, so that when I copy and paste the
slide into another presentation, the icons still reference the macro

2) generate a generic macro, that I can place in a module, that uses
something other than "me." to reference the current slide on the screen
during presentation?

Here's two versions of the macro I have used. The first works when placed in
the Slide section of the VBA project, and the second works when placed in the
Module of the project (but references the slide id which changes when copying
and pasting into another presentation.)

1) (For current slide)
Sub PlaySF_Flash()
Me.Shapes.Item(2).Visible = msoCTrue
Me.Shapes.Item(3).Visible = msoCFalse
Me.SF_Flash.Play
End Sub

2) (For Module1)
Sub PlaySF1_Flash()
Slide365.Shapes.Item(2).Visible = msoCTrue
Slide365.Shapes.Item(3).Visible = msoCFalse
Slide365.SF_Flash.Play
End Sub
 
S

Steve Rindsberg

This should give you what you need:

SlideShowWindows(1).View.Slide.SlideIndex

So

SlideShowWindows(1).View.Slide.Shapes.Item(2).Visible = msoCTrue
 
S

smullins

Thanks Steve. That got me half way there. It works for the first two lines of
the script when refering to the Shapes collection, but it doesn't work when
refering to the SF_Flash object on the page. I have verified the object name,
but I get the error
Compile Error: Method or Data Member not found, highlighting SF_Flash.
Here's the revised script

SlideShowWindows(1).View.Slide.Shapes.Item(2).Visible = msoCTrue
SlideShowWindows(1).View.Slide.Shapes.Item(3).Visible = msoCFalse
SlideShowWindows(1).View.Slide.SF_Flash.Play
 
S

Steve Rindsberg

Thanks Steve. That got me half way there. It works for the first two lines of
the script when refering to the Shapes collection, but it doesn't work when
refering to the SF_Flash object on the page. I have verified the object name,
but I get the error
Compile Error: Method or Data Member not found, highlighting SF_Flash.
Here's the revised script

SlideShowWindows(1).View.Slide.Shapes.Item(2).Visible = msoCTrue
SlideShowWindows(1).View.Slide.Shapes.Item(3).Visible = msoCFalse
SlideShowWindows(1).View.Slide.SF_Flash.Play

Assuming the shape's name is SF_Flash:

SlideShowWindows(1).View.Slide.Shapes("SF_Flash").OLEFormat.Object.Play

or

SlideShowWindows(1).View.Slide.Shapes("SF_Flash").OLEFormat.Object.Playing =
True

Note that you can simplify the code, save your fingers and have it run .0000042
nanoseconds faster by using this:

Dim oSl as Slide
Set oSl = SlideShowWindows(1).View.Slide
With oSl
.Shapes.Item(2).Visible = msoCTrue
.Shapes.Item(3).Visible = msoCFalse
.Shapes("SF_Flash").OLEFormat.Object.Playing = True
End With ' oSl
 
S

smullins

Thanks.. That works great.. now all I need to do is remember to copy the
macro when I copy the slides..... You've been a big help. Its appreciated.
 

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