Running macros to delete objects during a slide show--is it possib

C

Cliff

I wonder if anyone knows a way to delete objects such as text boxes during a
presentation. I'm trying to set up a presentation that's like a jeopardy
game. I set this up by having a table with the questions. Covering each of
the questions (i.e., the cells within the table, I have an opaque text box
with the number of points for the question.

I want it to work so that when a person chooses one of the boxes, I click on
it and the question (covered by the text box) appears. For example, there's
a box with "100 points" on it. When I click on it, the question that was
covered by the "100 points" text box should appear.

What I tried to do is to create/record a macro that deletes the text box (so
the question underneath it in the table appears). I tested this macro by
clicking on tools->macro->macros->run, and it works fine. I run the macro
and the text box disappears.

So next, I went into the action settings for the text box in question, and
attached the macro that I just created (that should remove the text box).
But when I run the slide show, this doesn't work. I click on the text box
but it doesn't disappear.

Does anyone have any ideas why this macro won't work during the slide show?
Is it that macros that delete objects just won't work during a slide show?

Any help--ways of deleting objects during slide shows, or ways of getting
around the inability to do this--would be greatly appreciated!

Thanks,
-Cliff
 
B

Bill Dilworth

The simple answer is probably that the show object model is different than
the edit object model, but that won't answer your question.

Yes, you can use VBA Macros to delete an object during a presentation, but
there are much less presentationally destructive ways to do what you want.
There are multiple examples of Jeopardy style games available already all
over the web,in case you wanted to go with a pre-made solution. I've seen
macros, triggers, and hyperlinking methods all used rather well.

Here's a small list:
http://facstaff.uww.edu/jonesd/games/games_parade_jeopardy.html
http://www.pttinc.com/ppgame.htm
http://www.loyola.edu/education/PowerfulPowerPoint/
http://www.echosvoice.com/jeopardy.htm

If you would rather write the code yourself, post the code you are using and
we'll show you where you will need to change it.

--
Bill Dilworth
Microsoft PPT MVP Team
===============
Please spend a few minutes checking vestprog2@
out www.pptfaq.com This link will yahoo.
answer most of our questions, before com
you think to ask them.

Change org to com to defuse anti-spam,
ant-virus, anti-nuisance misdirection.
..
..
 
T

TAJ Simmons

Cliff,

I'll give you a couple of clues....

Search for the "visible = true" type property

A macro recorded does not work during a slideshow as some of the commands are different.

Cheers
TAJ Simmons
microsoft powerpoint mvp

awesome - powerpoint backgrounds,
free powerpoint templates, tutorials, hints and tips etc
http://www.powerpointbackgrounds.com
 
B

Bill Foley

As Bill mentioned, I have a game sample you can download at:

http://www.pttinc.com/ppgame.htm

However, if you want to learn VBA, the trick is to:

Name your objects with names that make sense to you. PowerPoint gives a
name to an object when you create it, but it can get confusing knowing which
object you are trying to manipulate. For example, if you create an
AutoShape the name might be "AutoShape 125". Try remembering all 30 of
those in a Jeopardy game! What I do is name each number object as it
relates to the score. For example, the $100 answer for Category 1 is
"1-100".

The code that you can run to name each object is:

'=====Start of macro=====

Sub NameShape()
Dim Name$
On Error GoTo AbortNameShape

If ActiveWindow.Selection.ShapeRange.Count = 0 Then
MsgBox "No Shapes Selected"
Exit Sub
End If
Name$ = ActiveWindow.Selection.ShapeRange(1).Name

Name$ = InputBox$("Give this shape a name", "Shape Name", Name$)

If Name$ <> "" Then
ActiveWindow.Selection.ShapeRange(1).Name = Name$
End If
Exit Sub

AbortNameShape:
MsgBox Err.Description

End Sub

'=======End of macro======

The code to hide a shape on Slide 3 would be:

ActivePresentation.Slides(3).Shapes("1-100").Visible = False

Hope this gets you pointed in the right direction. Feel free to holler back
with any code that doesn't work for you.

Sincerely,
 
D

David M. Marcovitz

Another important point that Bill makes (but hides in his code) is that
it is a much better idea to hide the objects, rather than delete them.
That is where he use the .Visible = False thing in his code. This will
allow you to easily start the game over by showing everything.

Also, it is very hard to learn VBA for slide show view from recorded
macros. Recorded macros generally do things to objects by selecting them.
Selecting isn't possible slide show view, so you have to do other things,
such as naming objects as Bill discussed below. I find recording macros
useful to getting some details (like the exact RGB number for a color or
the exact location of an existing object).

--David

--
David M. Marcovitz
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 

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