From: Gary in AZ Gary in on
I'm writing a PPT-based tic-tac-toe game for a college class. I was going to
insert 2 invisiple objects in each square and record macros so that if you
clicked on the first object, an X would appear. Clicking on the second object
would cause an O to appear. Apparently, PPT 07 does not allow direct
recording of macros. You have to use VBA - (a little over my head at this
point). I can't hyperlink around like most games because there are too many
X/O combinations. I have to be able to put the X's & O's on a single slide.

Could anyone walk me through the process for writing this VBA code. (Or if
there is some other way to do this, I'm all ears)

Thanks
From: David Marcovitz on
On 11/20/09 8:14 AM, in article
DD6C4FD8-32D0-41C0-A60A-B3EFEFC4B8FB(a)microsoft.com, "Gary in AZ" <Gary in
AZ(a)discussions.microsoft.com> wrote:

> I'm writing a PPT-based tic-tac-toe game for a college class. I was going to
> insert 2 invisiple objects in each square and record macros so that if you
> clicked on the first object, an X would appear. Clicking on the second object
> would cause an O to appear. Apparently, PPT 07 does not allow direct
> recording of macros. You have to use VBA - (a little over my head at this
> point). I can't hyperlink around like most games because there are too many
> X/O combinations. I have to be able to put the X's & O's on a single slide.
>
> Could anyone walk me through the process for writing this VBA code. (Or if
> there is some other way to do this, I'm all ears)
>
> Thanks

Gary,

You just (correctly) suggested to another user that animations might be the
best way to go. That might be true for you as well. Why can't you have the
X's and O's be triggered by the clicks on your invisible buttons.

If you want to use VBA, I have been finding that the 2007 occasionally has
problems with macros that adjust the .Visible property of a shape. What I
have been recommending to my students is to adjust the .Top property of a
shape so it is off the screen (e.g. .Top = 3000) to make the shape invisible
and then put it back to normal (e.g. .Top = 150) to make the shape visible.

You will also need a procedure (probably run from the first slide) to set
the board up. If you were just dealing with two shapes, and you were to use
the .Visible property) the code would look something like this:

Sub Initialize()
ActivePresentation.Slides(2).Shapes("X1").Visible = msoFalse
ActivePresentation.Slides(2).Shapes("O1").Visible = msoFalse
End Sub

Sub ShowX1()
ActivePresentation.Slides(2).Shapes("X1").Visible = msoTrue
End Sub

Sub ShowO1()
ActivePresentation.Slides(2).Shapes("O1").Visible = msoTrue
End Sub

To avoid the problem with the Visible property, you could change .Visible =
False to .Top = 3000, and .Visible = True to .Top = 150 (or whatever will
get the shape in the right spot on the slide).

The other thing that you need to do is name all your shapes (you can see
shape-naming code on my site -- http://www.PowerfulPowerPoint.com/ -- in
Example 8.7).

--David

--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland


From: Gary in AZ on
David,

Thank you very much for your response. I'm getting a book on VBA, but the
learning curve will probably take a while. I am pretty proficient in PPT,
but have no idea how to trigger the X & O by clicking on the object. How is
this possible?

Thank you again for your help.

Gary

"David Marcovitz" wrote:

> On 11/20/09 8:14 AM, in article
> DD6C4FD8-32D0-41C0-A60A-B3EFEFC4B8FB(a)microsoft.com, "Gary in AZ" <Gary in
> AZ(a)discussions.microsoft.com> wrote:
>
> > I'm writing a PPT-based tic-tac-toe game for a college class. I was going to
> > insert 2 invisiple objects in each square and record macros so that if you
> > clicked on the first object, an X would appear. Clicking on the second object
> > would cause an O to appear. Apparently, PPT 07 does not allow direct
> > recording of macros. You have to use VBA - (a little over my head at this
> > point). I can't hyperlink around like most games because there are too many
> > X/O combinations. I have to be able to put the X's & O's on a single slide.
> >
> > Could anyone walk me through the process for writing this VBA code. (Or if
> > there is some other way to do this, I'm all ears)
> >
> > Thanks
>
> Gary,
>
> You just (correctly) suggested to another user that animations might be the
> best way to go. That might be true for you as well. Why can't you have the
> X's and O's be triggered by the clicks on your invisible buttons.
>
> If you want to use VBA, I have been finding that the 2007 occasionally has
> problems with macros that adjust the .Visible property of a shape. What I
> have been recommending to my students is to adjust the .Top property of a
> shape so it is off the screen (e.g. .Top = 3000) to make the shape invisible
> and then put it back to normal (e.g. .Top = 150) to make the shape visible.
>
> You will also need a procedure (probably run from the first slide) to set
> the board up. If you were just dealing with two shapes, and you were to use
> the .Visible property) the code would look something like this:
>
> Sub Initialize()
> ActivePresentation.Slides(2).Shapes("X1").Visible = msoFalse
> ActivePresentation.Slides(2).Shapes("O1").Visible = msoFalse
> End Sub
>
> Sub ShowX1()
> ActivePresentation.Slides(2).Shapes("X1").Visible = msoTrue
> End Sub
>
> Sub ShowO1()
> ActivePresentation.Slides(2).Shapes("O1").Visible = msoTrue
> End Sub
>
> To avoid the problem with the Visible property, you could change .Visible =
> False to .Top = 3000, and .Visible = True to .Top = 150 (or whatever will
> get the shape in the right spot on the slide).
>
> The other thing that you need to do is name all your shapes (you can see
> shape-naming code on my site -- http://www.PowerfulPowerPoint.com/ -- in
> Example 8.7).
>
> --David
>
> --
> David M. Marcovitz
> Author of _Powerful PowerPoint for Educators_
> http://www.PowerfulPowerPoint.com/
> Microsoft PowerPoint MVP
> Associate Professor, Loyola University Maryland
>
>
> .
>
From: David Marcovitz on
There are many tutorials on animation triggers that will help you if you
choose to go that route. Here are some examples:

http://pptheaven.mvps.org/tutorials/trigger.html

http://www.indezine.com/products/powerpoint/cool/trigger01.html

http://office.microsoft.com/en-us/powerpoint/HA010873001033.aspx

--David

On 11/20/09 7:58 PM, in article
CFF59FD2-0DE4-43CB-B79F-5E0CD30D398F(a)microsoft.com, "Gary in AZ"
<GaryinAZ(a)discussions.microsoft.com> wrote:

> David,
>
> Thank you very much for your response. I'm getting a book on VBA, but the
> learning curve will probably take a while. I am pretty proficient in PPT,
> but have no idea how to trigger the X & O by clicking on the object. How is
> this possible?
>
> Thank you again for your help.
>
> Gary
>
> "David Marcovitz" wrote:
>
>> On 11/20/09 8:14 AM, in article
>> DD6C4FD8-32D0-41C0-A60A-B3EFEFC4B8FB(a)microsoft.com, "Gary in AZ" <Gary in
>> AZ(a)discussions.microsoft.com> wrote:
>>
>>> I'm writing a PPT-based tic-tac-toe game for a college class. I was going to
>>> insert 2 invisiple objects in each square and record macros so that if you
>>> clicked on the first object, an X would appear. Clicking on the second
>>> object
>>> would cause an O to appear. Apparently, PPT 07 does not allow direct
>>> recording of macros. You have to use VBA - (a little over my head at this
>>> point). I can't hyperlink around like most games because there are too many
>>> X/O combinations. I have to be able to put the X's & O's on a single slide.
>>>
>>> Could anyone walk me through the process for writing this VBA code. (Or if
>>> there is some other way to do this, I'm all ears)
>>>
>>> Thanks
>>
>> Gary,
>>
>> You just (correctly) suggested to another user that animations might be the
>> best way to go. That might be true for you as well. Why can't you have the
>> X's and O's be triggered by the clicks on your invisible buttons.
>>
>> If you want to use VBA, I have been finding that the 2007 occasionally has
>> problems with macros that adjust the .Visible property of a shape. What I
>> have been recommending to my students is to adjust the .Top property of a
>> shape so it is off the screen (e.g. .Top = 3000) to make the shape invisible
>> and then put it back to normal (e.g. .Top = 150) to make the shape visible.
>>
>> You will also need a procedure (probably run from the first slide) to set
>> the board up. If you were just dealing with two shapes, and you were to use
>> the .Visible property) the code would look something like this:
>>
>> Sub Initialize()
>> ActivePresentation.Slides(2).Shapes("X1").Visible = msoFalse
>> ActivePresentation.Slides(2).Shapes("O1").Visible = msoFalse
>> End Sub
>>
>> Sub ShowX1()
>> ActivePresentation.Slides(2).Shapes("X1").Visible = msoTrue
>> End Sub
>>
>> Sub ShowO1()
>> ActivePresentation.Slides(2).Shapes("O1").Visible = msoTrue
>> End Sub
>>
>> To avoid the problem with the Visible property, you could change .Visible =
>> False to .Top = 3000, and .Visible = True to .Top = 150 (or whatever will
>> get the shape in the right spot on the slide).
>>
>> The other thing that you need to do is name all your shapes (you can see
>> shape-naming code on my site -- http://www.PowerfulPowerPoint.com/ -- in
>> Example 8.7).
>>
>> --David
>>
>> --
>> David M. Marcovitz
>> Author of _Powerful PowerPoint for Educators_
>> http://www.PowerfulPowerPoint.com/
>> Microsoft PowerPoint MVP
>> Associate Professor, Loyola University Maryland
>>
>>
>> .
>>

--
David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
Microsoft PowerPoint MVP
Associate Professor, Loyola University Maryland