Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General PowerPoint Questions / June 2006

Tip: Looking for answers? Try searching our database.

vba PowerPoint and Shapes

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Patrick - 12 Jun 2006 20:09 GMT
Hello. Almost completely new to scripting in PowerPoint but wonder if anyone
can direct me.

I am using PowerPoint 2003, and want to add a bunch of shapes to a slide.
When one shape is clicked, you jump to a different slide. When you click back
to the original slide, the shape(s) that have already been clicked are set to
0% visibility, or are dimmed. Does anyone have any idea how this is done?

Thanks very much!!
David M. Marcovitz - 12 Jun 2006 20:21 GMT
You could do this without scripting, using trigger animations. You could
also do this with scripting with something like:

Sub DimAndGo(oShp As Shape)
  oShp.Fill.ForeColor.RGB = vbBlue
  ActivePresentation.SlideShowWindow.View.GotoSlide 3
End Sub

Change vbBlue to some other suitable dimming color and 3 to some other
suitable slide number.

--David

Signature

David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

> Hello. Almost completely new to scripting in PowerPoint but wonder if
> anyone can direct me.
[quoted text clipped - 6 lines]
>
> Thanks very much!!
tohlz - 12 Jun 2006 20:37 GMT
For PowerPoint 2003, you can use triggers.
First, go to Custom Animation and add Emphasis (Transparency) to all the
shapes.
Double click on the first effect you have added, click Timing tab.
Click Triggers and select "Start effect on click of".
Click on the dropdown field, look for this shape that you are animating on,
have it trigger on itself.
Repeat steps on other autoshapes.

Finally, add a "Next page" hyperlink or a hyperlink to different slides on
the autoshapes.
Signature

Shawn Toh (tohlz)
Microsoft Most Valuable Professional (MVP PowerPoint)

Site Updated: June 08, 2006
Added PowerPoint Movies.
http://pptheaven.mvps.org
PowerPoint Heaven - The Power to Animate

> You could do this without scripting, using trigger animations. You could
> also do this with scripting with something like:
[quoted text clipped - 19 lines]
> >
> > Thanks very much!!
Patrick - 12 Jun 2006 21:53 GMT
Thanks for the info. If I do it this way (VBA vs. triggers), do I need some
sort of onClick event handler in the script? How about if I have multiple
shapes? Does each shape need some sort of unique name/information?

The trigger suggestions are working pretty well, however I wonder if the
script option might solve for the fact that I click and go to another slide,
and then when I click a link to return, the initial shape is on the slide for
a quick moment before it disappears. Would not want the object to be there
when I return to that slide.

Thanks!

> You could do this without scripting, using trigger animations. You could
> also do this with scripting with something like:
[quoted text clipped - 19 lines]
> >
> > Thanks very much!!
John Wilson - 12 Jun 2006 22:48 GMT
You can adapt the code above so that the shape is invisible

Sub DimAndGo(oShp As Shape)
oShp.Visible = msoFalse
ActivePresentation.SlideShowWindow.View.GotoSlide 3
End Sub

Set an action setting on the shape to Run macro "DimandGo"

A problem you will find is once invisible its not that easy to get it back
unless you write more code to reset it ti msotrue. The original code to
change colour is safer.
Signature

-----------------------------------------
Did that answer the question / help?
_____________________________
John Wilson
Microsoft Certified Office Specialist

> Thanks for the info. If I do it this way (VBA vs. triggers), do I need some
> sort of onClick event handler in the script? How about if I have multiple
[quoted text clipped - 31 lines]
> > >
> > > Thanks very much!!
tohlz - 13 Jun 2006 02:06 GMT
Patrick, if you are using trigger, you can have the shape staying there for a
quick moment before it disappear as well. You will need to make use of delay.
If you are using Emphais (Transparency) effect, set the transparency effect
to 100%.
Alternately, use Exit (Disappear) effect works too.

Next, double click on the effect and go into the timing tab.
Under timing, there is a delay where you can set 'x' seconds before the
effect starts to trigger itself.
For instance, if you set it to 2 seconds, when you click on the shape, it
will jump into another slide. Then, when you hyperlink back to that slide,
the shape will stay there for 2 seconds before it disappear.
Signature

Shawn Toh (tohlz)
Microsoft Most Valuable Professional (MVP PowerPoint)

Site Updated: June 08, 2006
Added PowerPoint Movies.
http://pptheaven.mvps.org
PowerPoint Heaven - The Power to Animate

> Thanks for the info. If I do it this way (VBA vs. triggers), do I need some
> sort of onClick event handler in the script? How about if I have multiple
[quoted text clipped - 31 lines]
> > >
> > > Thanks very much!!
David M. Marcovitz - 13 Jun 2006 14:46 GMT
No, you do not need any special event handlers. All you need to do is set
the action settings for any shape to DimAndGo. It automatically takes care
of the shape that was clicked.

Yes, the VBA can be written so the shape is not visible at all when you get
back. If you want to make it invisible, you need:

oShp.Visible = msoFalse

As John pointed out, the problem with making shapes invisible is making
them visible again. The way I generally solve this is with a procedure that
I link to a button on the first slide. That procedure is used to set
everything up the way I want it (including hiding or unhiding shapes and
initializing variables and resetting shape colors). You can see an example
of this at my site

http://www.PowerfulPowerPoint.com/

We seem to be having a temporary problem with our site this morning, so if
that link doesn't work, you can go to:

http://webdev.loyola.edu/dmarco/education/PowerfulPowerPoint/

The simplest example is Example 5.5. This actually hides shapes in my
Initialize procedure because I don't want the stars to be visible when you
start, but you could easily have it unhide things (changing False to True).
The problem is that you have a whole bunch of shapes that you will want to
unhide. You could either list them one by one in an Initialize procedure,
or you could write a simple routine to unhide everything:

Sub UnhideItAll()
   Dim oSld As Slide
   Dim oShp As Shape
   For Each oSld in ActivePresentation.Slides
       For Each oShp in oSld.Shapes
           oShp.Visible = msoTrue
       Next oShp
   Next oSld
End Sub

This should unhide EVERY shape in the presentation, but I just scribbled it
down off the top of my head without testing so I don't guarantee it works.

--David

Signature

David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

> Thanks for the info. If I do it this way (VBA vs. triggers), do I need
> some sort of onClick event handler in the script? How about if I have
[quoted text clipped - 32 lines]
>> >
>> > Thanks very much!!
Patrick - 13 Jun 2006 16:48 GMT
I AM SO CLOSE! Thanks, first off, for your help...I am nearly there. The
current script works fine...

Sub DimAndGo(oShp As Shape)
   oShp.Visible = msoFalse
   ActivePresentation.SlideShowWindow.View.GotoSlide 3
End Sub

And the unhiding works too. Question: I have multiple shapes on slide 1.
Each shape should become invisible once clicked, but clicking each shape
should advance the show to a different slide (i.e., click shape 1 to go to
page 2, click shape 2 to go to page 3, but each should be invisible when I
return).

How is this possible??

Thanks!

> No, you do not need any special event handlers. All you need to do is set
> the action settings for any shape to DimAndGo. It automatically takes care
[quoted text clipped - 77 lines]
> >> >
> >> > Thanks very much!!
David M. Marcovitz - 13 Jun 2006 16:59 GMT
If the shapes have to go to different places, then you have two choices:

(1) Use multiple DimAndGo procedures, such as:

Sub DimAndGo3(oShp As Shape)
    oShp.Visible = msoFalse
    ActivePresentation.SlideShowWindow.View.GotoSlide 3
End Sub

Sub DimAndGo4(oShp As Shape)
    oShp.Visible = msoFalse
    ActivePresentation.SlideShowWindow.View.GotoSlide 4
End Sub

etc.

Attach each procedure to the appropriate button.

(2) Find a way to use the properties of the shape to tell you where to go
so you can only have one procedure. For example, if the text of the
button is the number of the slide to go to, you could do something like
this (untested and without error checking so use at your own risk):

Sub DimAndGo(oShp As Shape)
    oShp.Visible = msoFalse
    ActivePresentation.SlideShowWindow.View.GotoSlide _
        oShp.TextFrame.TextRange.Text
End Sub

Other code could be written based on parts of the text or location of the
shape or ..., but it is probably easier to do a little copying and
pasting and just have a bunch of slightly different procedures.

--David

Signature

David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

> I AM SO CLOSE! Thanks, first off, for your help...I am nearly there.
> The current script works fine...
[quoted text clipped - 98 lines]
>> >> >
>> >> > Thanks very much!!
Steve Rindsberg - 13 Jun 2006 19:41 GMT
Rats.  I pushed the button on an example that does more or less this but it
seems to have disappeared.  But see the mod to your code below:

> (2) Find a way to use the properties of the shape to tell you where to go
> so you can only have one procedure. For example, if the text of the
> button is the number of the slide to go to, you could do something like
> this (untested and without error checking so use at your own risk):

Sub DimAndGo(oShp As Shape)
    oShp.Visible = msoFalse
'     ActivePresentation.SlideShowWindow.View.GotoSlide _
'         oShp.TextFrame.TextRange.Text
    ' The parent of the current shape is the slide
    ' so we can get the slide index from that:
    ActivePresentation.SlideShowWindow.View.GoToSlide _
         oShp.Parent.SlideIndex + 1
         
End Sub

> Other code could be written based on parts of the text or location of the
> shape or ..., but it is probably easier to do a little copying and
> pasting and just have a bunch of slightly different procedures.
>
> --David

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
David M. Marcovitz - 13 Jun 2006 20:13 GMT
Hmm. The current slide is the first slide, so wouldn't this always take you
to the second slide. Unless I misunderstood the problem. I thought the OP
had a bunch of shapes on one slide that each would take you to various
slides.
--David

Signature

David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

Steve Rindsberg <abuse@localhost.com> wrote in news:VA.00002783.1cce2606
@localhost.com:

> Sub DimAndGo(oShp As Shape)
>      oShp.Visible = msoFalse
[quoted text clipped - 6 lines]
>          
> End Sub
Steve Rindsberg - 14 Jun 2006 00:56 GMT
> Hmm. The current slide is the first slide, so wouldn't this always take you
> to the second slide. Unless I misunderstood the problem. I thought the OP
> had a bunch of shapes on one slide that each would take you to various
> slides.

Twisted threads?  You're right ... I'm thinking of something else here.

Wish I could remember what!  ;-)

> --David
>
[quoted text clipped - 8 lines]
> >          
> > End Sub

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Patrick - 19 Jun 2006 15:16 GMT
It looks like this all worked and that the requestor is pleased with the
result. Could not have done this without everyone's help, and I thank you
very much for your time and for sharing your knowledge.

Thanks!

> > Hmm. The current slide is the first slide, so wouldn't this always take you
> > to the second slide. Unless I misunderstood the problem. I thought the OP
[quoted text clipped - 23 lines]
> PPTools:  www.pptools.com
> ================================================
David M. Marcovitz - 19 Jun 2006 16:19 GMT
Great! I'm glad it all worked out for you and the requestor. Thanks for
getting back to us.
--David

Signature

David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

> It looks like this all worked and that the requestor is pleased with
> the result. Could not have done this without everyone's help, and I
[quoted text clipped - 30 lines]
>> PPTools:  www.pptools.com
>> ================================================
John Wilson - 12 Jun 2006 20:25 GMT
This doesnt require vba code.
Give each shape an action setting to hyperlink wherever and also an emphasis
effect > desaturate

Double click the emphasis entry in custom animation and in timing set it to
start effect on click of trigger = itself
Signature

-----------------------------------------
Did that answer the question / help?
_____________________________
John Wilson
Microsoft Certified Office Specialist

> Hello. Almost completely new to scripting in PowerPoint but wonder if anyone
> can direct me.
[quoted text clipped - 5 lines]
>
> Thanks very much!!

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.