PPT VBA - Clicking on non-existent textbox?

Z

Zigzag

Ah, Monsieur Hollerith is a good fellow but he doesn't know how easy his
life was. Cards? We only had stacks of >wooden slabs. And we had to run
thread every which way through them before we could think of starting. And
they kept >the machinery atop a mountain we had to climb every morning.
Barefoot. Through thorns that grew atop the icepack.

Luxury. And you tell kids these days and they don't believe you.
Cobol seemed SO longwinded. We had to enter everything onto punchcards;
bad enough in Fortran. I'd still be punching >at it if I'd done Cobol!

I too started with Fortran, then Pascal, then Cobol. When starting Cobol I
believed it was like writing in sanskrit, it looked so archaic. But you
know, after a while, I preferred it. I believe the effect is something akin
to the Stockholm syndrome.

Now OO languages I just can't get my head around. That's not a criticism of
the genre, just my view of them.

Which brings me, longwindedly, to my problem which I hope someone can help
me with.

I am experimenting with putting together a presentation on one slide using
animation appear and disappear effects. I know that a work-around would be
to use more than one slide but I would like to learn how to resolve this
particular problem.
When I click on an image, an associated descriptive textbox fades in. This
is fine until I have more text than I can reasonably show in the textbox. If
there is more text I display a "More >>>" textbox on the slide and make it
clickable to fade out the original description and fade in the additional
text. This works hunky-dory until I have more than one image with two pages
of text. As the "More >>>" textboxes are located in the same position on the
slide then ppt only allows me to click on the one on top of the zorder.
I've tried moving the appropriate "More >>>" textbox to the top of the
zorder using vba. This moves the textbox but doesn't make it clickable when
running the show. Understandable but not the effect I want.
So here's what I now want to do:
Click on an image to display the descriptive text and Create the "More >>>"
textbox (where appropriate).
Click on the created "More >>>" textbox to fade out the descriptive text,
show the additional textbox and remove the "More >>>" textbox.
I can use vba to create the "More >>>" textbox but I don't know how to make
it clickable and associate a procedure with it when it doesn't exist at
runtime. I need to do this for each image where there is more than one
textbox worth of descriptive text.

Any help would be appreciated.

TIA

Zig
 
G

Guest

Zigzag,

There are several ways to do what you want to do. If you want to create
shapes and make them clickable in run time, check out Example 7.9 on my Web
site:

http://www.loyola.edu/education/PowerfulPowerPoint/

Go to "Examples by Chapter" and "Chapter 7." In example 7.9, you want to
look at the PrintablePage procedure. This procedure creates a slide and puts
some text on the slide. Additionally, it creates two buttons: homeButton and
printButton. These buttons are created and assigned a macro to run, which is
just what you asked for.

However, if I were doing what you wanted, I would probably create all the
shapes in advance and hide and show the shapes as needed, using the shapes'
..Visible properties. That way, you don't have to keep track of what has been
created and deleted, and you don't have to worry about using code to add text
or make shapes clickable. All the code needs to do is hide or show the
appropriate shapes by setting .Visible to True or False.

--David

David Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
K

Kathy J

Unless you are really stuck on doing this using VBA, there is an easier way.
Create one "More" button for each set of text that is longer than one box.
Give it an appear animation. Drag that appear animation to just after the
triggered animation for the first text box. Now, when you click the trigger
for the text box, both the text box and the more box appear. (Oh, and don't
forget to add it's exit to the trigger for making the second text box
disappear. But you know that already.)

About OO - Think about a light switch. From the standpoint of one in the
room, all they care about is that flipping a light switch turns on a light.
It is an object that when moved causes something to happen. It is connected
to objects called wires that are either open circuits or closed circuits.
When open they carry content (electricity) to the light. When closed they
turn stop carrying content. Each layer of OO code is an object doing
something to either content or another object.(Another way to think of it:
Instead of functions that pass data as parameters, in OO worlds there are
objects that do things to data.)

--
Kathryn Jacobs, Microsoft MVP PowerPoint and OneNote
Author of Kathy Jacobs on PowerPoint - Available now from Holy Macro! Books
Get PowerPoint answers at http://www.powerpointanswers.com
I believe life is meant to be lived. But:
if we live without making a difference, it makes no difference that we lived
 
Z

Zigzag

Hi David,

Thanks for the response, I'll have a look at the example you mentioned.
All the code needs to do is hide or show the
appropriate shapes by setting .Visible to True or False.

I effectively tried this for a couple of "More >>>" textboxes using the
custom animation fade in and disappear. The problem is not the fact that the
boxes don't show but as they are on top of one another in the zorder only
one becomes clickable (whether it is showing or not). Changing the zorder at
runtime does not seem to change which box is actually clickable (it always
appears to be the one on top when the presentation starts).
For a matter of record, I also tried to motion path the boxes to and away
from the position I wanted them in but the clickable areas for both boxes
remained at their starting positions. It's as if the clickable areas get
'locked' when the presentation starts.

I'll have a look at the example.

Cheers

Zig
 
G

Guest

I have never seen the behavior you described. If a shape is not visible, then
it should not be covering anything up, and it should not be clickable. What
happens if you set the top and right of the shape to something like -500
-500. Then, it surely won't be covering anything up (or visible).

Of course, you can set the Shape's ZOrder by using

shp.ZOrder msoSendToBack

--David

David Marcovitz
Author of _PowerfulPowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
Z

Zigzag

Hi Kathy,

Welcome back to 100 Aker Wood.
About OO - Think about a light switch.

I think I've given a slightly misleading impression regarding my approach to
OO. I understand, roughly, how it operates and I do have certificates in
Javascript and Java. What I can't get to grips with is the need to know what
objects exist and what can and can't be done by built-in procedures.
For instance, I want to add an effect - what methods are available and on
which object(s)?
I want to create a textbox in runtime and make it clickable to do something.
Honest to God, Kathy, I didn't know where to start. I tried the vba help and
tried to extrapolate from examples, all to no avail. "Think, think, think".

Given the popularity of OO I can only resign myself to the fact that I have
a short circuit somewhere which refuses to identify the logic behind these
languages. "Oh, bother".
With the 'old' languages you had a number of commands that you applied in a
logical sequence to achieve what you wanted - read, manipulate, write.
Now, you can do all sorts - if you know what's available, or so it seems to
me.
Unless you are really stuck on doing this using VBA, there is an easier
way. Create one "More" button for each set of text that is longer than one
box. Give it an appear animation. Drag that appear animation to just after
the triggered animation for the first text box. Now, when you click the
trigger for the text box, both the text box and the more box appear. (Oh,
and don't forget to add it's exit to the trigger for making the second
text box disappear. But you know that already.)

Have already tried this Kathy. The problem lies in the fact that I might
have more than one "More" box at the same location on the slide even if only
one is showing. PPT seems to 'lock' the clickability of the top box even if
you change the zorder in runtime.

Regards

Mr. Sanders
 
Z

Zigzag

Groan!

There's only one thing you can say to that:

Gol Forth Solo Mantis AndF Multi-pascal.

Sorry about the Lisp.

Zig (& CAT)
 
G

Guest

Are you using a Mac or Windows? In Windows, the VBA Editor will prompt you
with suggestions for what comes next. You can scroll through the list of
available methods and properties. Every time you hit dot on the keyboard a
new list comes up of available options.

Also, as bad as the help is, it can also give you a list of available
properties and methods. Once you get to the right page (Shape, for example),
there is link to properties and another to methods. This is very helpful.

--David

David Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
G

Guest

That brings back memories. I don't know if I have ever met anyone else who
has even heard of SNOBOL. If I look hard enough, I might even find an old
SNOBOL book in my office from a class I took many years ago. Sorry about this
message that breaks the STRING of programming language puns.
--David

David Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
Z

Zigzag

Hi Austin,

Thanks for the info, looks like a long read.

I'll have a read at leisure and see if something clicks (pun intended).

Cheers

Zig
 
K

Kathy J

What you have to do is to stack them in the right order, which is actually
the first one to be clicked on top, then the next one, then the next one. I
have an example I can send you off newsgroup that shows you what I mean.
Unknot the address to contact me.

--
Kathryn Jacobs, Microsoft MVP PowerPoint and OneNote
Author of Kathy Jacobs on PowerPoint - Available now from Holy Macro! Books
Get PowerPoint answers at http://www.powerpointanswers.com
I believe life is meant to be lived. But:
if we live without making a difference, it makes no difference that we lived
 
A

Austin Myers

Read? No, commit to memory! <eg>

If you want drop me an email and I can send you a help file that has just
the PPT stuff and is geared specifically to give you all the events,
properties, and methods available. (A handy reference to be sure.)


Austin Myers
MS PowerPoint MVP Team
 
A

Austin Myers

But making puns is such a BASIC thing...



David M. Marcovitz said:
That brings back memories. I don't know if I have ever met anyone else who
has even heard of SNOBOL. If I look hard enough, I might even find an old
SNOBOL book in my office from a class I took many years ago. Sorry about this
message that breaks the STRING of programming language puns.
--David

David Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
K

Kathy J

Got another answer for you:
Simple record of sending an item to back shows that you can use:
ActiveWindow.Selection.ShapeRange.ZOrder msoSendToBack
to send an element to the back. I bet that you can figure out how to make it
do the ordering you need... :) (After all, if I could...)

--
Kathryn Jacobs, Microsoft MVP PowerPoint and OneNote
Author of Kathy Jacobs on PowerPoint - Available now from Holy Macro! Books
Get PowerPoint answers at http://www.powerpointanswers.com
I believe life is meant to be lived. But:
if we live without making a difference, it makes no difference that we lived
 
K

Kathy J

I C what you mean. 'Ada join in here sooner or later. Couldn't let all this
language Smalltalk go by too long.
 
S

Steve Rindsberg

Hi David,
I effectively tried this for a couple of "More >>>" textboxes using the
custom animation fade in and disappear. The problem is not the fact that the
boxes don't show but as they are on top of one another in the zorder only
one becomes clickable (whether it is showing or not).

Try using GoToSlide( your current slide's slide index ) after making changes to
zorder/visibility.

Changing the zorder at
 
S

Steve Rindsberg

Given the popularity of OO I can only resign myself to the fact that I have
a short circuit somewhere which refuses to identify the logic behind these
languages.

My money's betting the other way. Give it time, poke it a bit and sooner or
later (I'm betting on sooner) the Light.On event will fire and
ZigZag.Aha.NowIGetIt will toggle from false to true.
With the 'old' languages you had a number of commands that you applied in a
logical sequence to achieve what you wanted - read, manipulate, write.
Now, you can do all sorts - if you know what's available, or so it seems to
me.

Go into the vba editor and press F2 (object browser). And also look up the
object model in VBA help. Very useful.
 

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