PPT VBA - Clicking on non-existent textbox?

S

Steve Rindsberg

David M. said:
I think that is where we started. For some reason, when he makes
textboxes invisible, he is having a hard time clicking on the text boxes
that are underneath the invisible ones. I wonder if the animations are
affecting this since he has a bunch of shapes animated on the slide.

Turn me loose in the opun air and I get lost every time, don't I?

ZigZag me old buddy, can you reproduce the problem on a very simple slide, just
a couple shapes that illustrate the problem? If so, let us know, maybe squire
it to the both of us ( me = steve at-sighing pptools fullstop com)
 
Z

Zigzag

Hi David,

Thank you for the response.

Just in case I've got some kind of corruption I'm going to start again from
scratch. I've attempted a lot of fixes and at one point I actually saw 2
different shapes with the same shape number in the custom animation tile. I
didn't save the presentation so assumed all changes would be lost.
Have you
tried using VBA to move the text boxes off-screen instead of hiding them

I tried motion paths to put the textboxes in place when needed and move them
out again when not. This gave the result that although the boxes moved, the
clickable areas remained at the starting positions of the paths and not the
end positions where I needed them.

Although I am currently using:
ActivePresentation.Slides(1).Shapes.AddTextbox(msoTextOrientationHorizontal,
609.5, 496.75, 107.75, 28.875) (which I got from your example 7.9 by the
way)
I started off using
ActiveWindow.Selection.SlideRange.Shapes.AddTextbox(msoTextOrientationHorizontal,
609.5, 496.75, 107.75, 28.875) which worked fine when run from VB editor but
wouldn't work at all from within the slideshow. I assumed that it was some
kind of context thing. VB help was gobbledygook on the subject.
Ah c'mon, try it, it's not that hard:)

I've spent literally man-days trying to figure out how to do animation in
vba using the vb help without success. It wasn't until I went to Steve's
site and MSDN that I could even begin to comprehend. The vba help is a
reference tool, extensive, but that's as far as it goes in usefulness. As I
said in a previous post I am quite prepared to accept that it's me who has a
mental block as I've tried and failed a number of times to get into vba. And
before I give the impression of feeling sorry for myself, I've got to say
I'm completely confident with hacking code, just not oo.
Does that answer your question ;-)
You should be able to get it to work. I'm not sure why it is not
working for you.

Me neither, so I'm calling it a day if it still doesn't work after
rebuilding from scratch.

I do, however, thank everyone for their time, patience and advice.

Regards

Zig
 
S

Steve Rindsberg

You're dead-on correct about the Help. It's ok as a reference when it works
to that extent. As a learning tool, it's not of much use.

ActivePresentation.Slides(1).Shapes.AddTextbox(msoTextOrientationHorizontal,
609.5, 496.75, 107.75, 28.875) (which I got from your example 7.9 by the
way)
I started off using
ActiveWindow.Selection.SlideRange.Shapes.AddTextbox(msoTextOrientationHorizo
ntal,
609.5, 496.75, 107.75, 28.875) which worked fine when run from VB editor but
wouldn't work at all from within the slideshow. I assumed that it was some
kind of context thing. VB help was gobbledygook on the subject.

In case it helps kick out the (mental) jams, let's look at what those bits
of code are doing:

The first one breaks down like so:

The current active presentation is the one you see on screen
It contains a collection of slides
..Slides(1) refers to the first slide in that collection
Like other slides, it contains a collection of shapes
..Shapes refers to that collection
..AddWhatever tells PPT you want to add a new shape to the collection
(in this case, a textbox)
The rest of the stuff in parens is the specifics about the text box-you've
got that bit down cold, no problems, right? Right.

The next bit of code:
ActiveWindow.Selection.SlideRange.Shapes.AddTextbox

starts with the PowerPoint application (implicitly)
The app has a collection of windows
ActiveWindow points to the one that's currently active - ie, has focus
If you're in screenshow mode, it's the screen show window.
..Selection refers to whatever's selected; in slide show view, this code will
error because there CAN be no selection in a slide show.
Because you can't select anything, you can't add shapes in this view.

If that hasn't left you utterly befuddled, please do speak up. I can go on
for hours longer if you like.
 
Z

Zigzag

Hi Steve,

Thank you for the clarification, now about the other 1,700,546...

I've noticed a number of recommendations on the net to use the Record Macro
function to clarify certain vba uses and that is where the ActiveWindow code
came from.

I started to wonder why there was a Selection property on ActiveWindow when
you can't select anything in the show and then realised it's not to be used
in that context, right? Rhetorical: I wonder how many other objects, methods
& properties fall into this category?

Regards

Zig
 
D

David M. Marcovitz

Yes, record macro is good once you understand how to change the macro to
work in Slide Show view. I think your starting to get that now. This
feature sometimes trips up even experienced VBA programmers because there
is no such thing as Slide Show view in the other Office apps.

By the way, just so you don't feel so alone and embarassed...Last night
my multimedia design class handed in their first PowerPoint/VBA projects
(some of which will be appearing on my Web site under Examples From Real
People). Note that most of the students in the class are teachers and
have little or no programming background. When I asked for questions, one
young man timidly raised his hand and said "Is this stuff supposed to be
really hard?" I assured him that it was, indeed, supposed to be really
hard as three-quarters of the class nodded in agreement as if they had
been wondering the same thing.

--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/
 
Z

Zigzag

Hi David,

Lol

I hope that as a seasoned lecturer you still have sympathy for the poor
little mites ;-)
I remember an Operational Research lecturer eons ago losing his patience
(sic) whenever a student didn't get his meaning on being told something for
the first time. It was interesting to watch grown men (including a
lay-preacher and an IT department head) making excuses for bunking (hope
that's not a rude term in American-speak) out of his lessons.
Still, I know it can be a bit baffling when a student doesn't understand
something you feel is obvious through experience. I also have 2 teenagers of
my own. 'Nough said.

Regards

Zig
 
S

Steve Rindsberg

I've noticed a number of recommendations on the net to use the Record Macro
function to clarify certain vba uses and that is where the ActiveWindow code
came from.

The recorder can be handy for getting quick answers to "How do I reference
this or that feature" type questions. Or not. Sometimes it records nothing,
or at least nothing useful; sometimes that's for a perfectly good reason (it
can't be expected to record what you do while working in an activated
embedded Excel sheet, for example). And sometimes that's because it ain't
too bright. said:
I started to wonder why there was a Selection property on ActiveWindow when
you can't select anything in the show and then realised it's not to be used
in that context, right? Rhetorical: I wonder how many other objects, methods
& properties fall into this category?

Exactly so. Other than things that depend on the current selection or
specific types of window, there aren't all THAT many differences, luckily.
And after you've had your wrist slapped a few times, you develop a pretty
fair instinct for what'll work and what won't.
 
D

David M. Marcovitz

Actually, since the students were all handing in their projects at that
time, they had all figured it out (or at least most of it) already as of
last night. I think they were just surprised that I would make them do
something so hard. What catches me off guard is when they assume I think
they are having an easy time with it. This is only a problem if it gets
to the point where they are too embarassed to ask questions, thinking
that it should be easy.
--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/
 
Z

Zigzag

Hi David,

Indeed, until they realise that you are deliberately setting the work hard
and then you start finding the screws in your chair have worked loose ;-)

I've drilled into my 2 sprogs since kindergarten that if they don't
understand something then ask. It's better to be embarassed than ignorant,
especially with school education. If the foundation is not there how can
they be expected to learn the more complex ideas based upon that foundation.
The problem in a lot of cases is peer pressure.

Zig
 
Z

Zigzag

Hi Steve,
Sometimes it records nothing,

I noticed this when trying to record some of the custom animation.
And after you've had your wrist slapped a few times, you develop a pretty
fair instinct for what'll work and what won't.

The latter is the norm in my case and my wrists are so sore I'm back to
typing with my nose.

xoh
 
S

Steve Rindsberg

The latter is the norm in my case and my wrists are so sore I'm back to
typing with my nose.

Stop your whining. I've been poking at PPT with VBA since before version 97
was released. I'll show you sore wrists!!! ;-)
 
G

Glen Millar

The latter is the norm in my case and my wrists are so sore I'm back to
Stop your whining. I've been poking at PPT with VBA since before version 97
was released. I'll show you sore wrists!!! ;-)

Your wrists... his nose. I just started with this vba stuff. Knock it off.
You guys are scaring me!
 
Z

Zigzag

Hi Steve,
Stop your whining.

Sorry, the hearing aid's playing up again.
I've been poking at PPT with VBA since before version 97
was released.

Was that when it stood for Virtually Before Adam?
I'll show you sore wrists!!!

Easy! this is a family forum ;-)

Misinterpretation, selective extraction and contextual misalignment are arts
of the politician.

Zig
 
S

Steve Rindsberg

Was that when it stood for Virtually Before Adam?

Or: Visual Basic? Again????
Misinterpretation, selective extraction and contextual misalignment are arts
of the politician.

If you can say "contextual sense" three times fast ...
 
Z

Zigzag

Hi all,
When you click on either of the small textboxes look closely at where the
cursor changes to a hand. On one of them the cursor will change over the
whole textbox and on the other it will change only around the textbox
edge.

Not that I want to extend this thread any further, (cheers all round), but
for completeness I have just packaged and run the presentation on my machine
using the ppt viewer with 2003 and there is no problem clicking on the
textboxes. Still does it from ppt tho'.

No reply expected.

Cheers

Zig
 

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