Simple VBA code failure - PPT 2007!

B

Bill Foley

Hey gang,

Guess who's back! I finally broke down and bought Office 2007 (not sure why
though)! One of my games is not working correctly and I have no idea why.
I have very simple code that hides text boxes, then shows them when needed
using VBA. One of the objects shows up but the other one doesn't. Yes, I
verified the names of the shapes. I've used this in PPT 2003 for years with
no problems. If I go out of Slide Show mode, the text boxes the didn't show
up are visible.

Is this some sort of known bug with PPT 2007? Any ideas? They are simple
text boxes. Nothing more. Both created the exact same way in PPT 2003.

HELP!

Bill Foley
 
D

David Marcovitz

Waaal HOWDY Tex!


Several folks have reported similar problems, where making something
invisible/visible in code doesn't change what the user sees on screen in slide
show view.

It might be enough to do a View.GoToSlide(CurrentSlideIndex) to force a
refresh. If not ... um ... 2010's not far off.


==============================
PPT Frequently Asked Questions
http://www.pptfaq.com/

PPTools add-ins for PowerPoint
http://www.pptools.com/

What Steve said and ...

I started noticing this when I was teaching my class that uses VBA last
summer (I had people using 2003, 2004, and 2007 in the class). I found
that the best solution was to have the shape move off the viewable area
of the screen (e.g., set .Top to 5000). The problem is that you then
have to keep track of the original .Top so you can move it back to make
it visible. For my non-programming students, it was another annoying
layer of complexity.

By the way, welcome back!

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

David Marcovitz

I knew you would suggest tags, partly because they are a great solution
for this. I haven't played with them for this, but as I was writing my
post, I was imagining the code that would have a HideObject procedure
that would simultaneously move the object off the viewable portion of
the slide and then add a tag with the current location (but not in that
order). Then the ShowObject code would simply look in the tag to see
where the object was supposed to go. I guess I'll have to play with that
this summer when I teach my multimedia design class again.
--David

Thanks, David. I couldn't recall that li'l trick but knew you'd be along with it
shortly. Tip o' the 10-gallon hat to the man from Maryland.


Tags are good for this type of thing.


For my non-programming students, it was another annoying


==============================
PPT Frequently Asked Questions
http://www.pptfaq.com/

PPTools add-ins for PowerPoint
http://www.pptools.com/


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

Bill Foley

Well, Steve's refresh method did nothing. So, for something as simple as
the code below, what would I have to do to make the Q1-1 object appear?

Sub Correct1_1()
ActivePresentation.Slides(3).Shapes("Q1-1").Visible = True
ActivePresentation.Slides(3).Shapes("P1-1").Visible = True
End Sub

Funny thing, the P1-1 object shows up fine (matter of fact I have 5 of these
and they all show up). However, the Q1-1 through Q1-5 do not!

What would I have to do to make this work in PPT 2007? Man, why did this
happen in the first place? But, more importantly HOW???

Any clues would be appreciated. I would even be happy to send the game file
to you (off-line).

TIA!

Bill Foley
 
M

Mark

Well, Steve's refresh method did nothing.  So, for something as simple as
the code below, what would I have to do to make the Q1-1 object appear?

Sub Correct1_1()
ActivePresentation.Slides(3).Shapes("Q1-1").Visible = True
ActivePresentation.Slides(3).Shapes("P1-1").Visible = True
End Sub

Funny thing, the P1-1 object shows up fine (matter of fact I have 5 of these
and they all show up).  However, the Q1-1 through Q1-5 do not!

What would I have to do to make this work in PPT 2007?  Man, why did this
happen in the first place?  But, more importantly HOW???

Any clues would be appreciated.  I would even be happy to send the gamefile
to you (off-line).

TIA!

Bill Foley










- Show quoted text -

I don't know if it will help you, but I have found that running the
'go to current slide' twice tended to help refresh the screen in my
case (sometimes charts didn't show the proper data after being updated
with data from a Userform, but they seem to work better with a double-
go-to-current-slide). May be worth a try to see if it helps in your
case as well.
 
B

Bill Foley

No go. I have five buttons that when clicked show a text and a point value.
The point values always show (simple text boxes like the other ones).
However, still a NO-GO on the other text boxes. I thought about just having
a rectangle covering the text and having it hide on a trigger, but I still
have code that needs to show the otehr text box. Is there VBA code that
runs a trigger?

By the way, this is RIDICULOUS! I wish one of my clients never downgraded
to PPT 2007!

Bill Foley


Well, Steve's refresh method did nothing. So, for something as simple as
the code below, what would I have to do to make the Q1-1 object appear?

Sub Correct1_1()
ActivePresentation.Slides(3).Shapes("Q1-1").Visible = True
ActivePresentation.Slides(3).Shapes("P1-1").Visible = True
End Sub

Funny thing, the P1-1 object shows up fine (matter of fact I have 5 of
these
and they all show up). However, the Q1-1 through Q1-5 do not!

What would I have to do to make this work in PPT 2007? Man, why did this
happen in the first place? But, more importantly HOW???

Any clues would be appreciated. I would even be happy to send the game
file
to you (off-line).

TIA!

Bill Foley










- Show quoted text -

I don't know if it will help you, but I have found that running the
'go to current slide' twice tended to help refresh the screen in my
case (sometimes charts didn't show the proper data after being updated
with data from a Userform, but they seem to work better with a double-
go-to-current-slide). May be worth a try to see if it helps in your
case as well.
 
B

Bill Foley

Hey Gang,

I gave up trying to figure out why PPT 2007 works this way and just came up
with a workaround. For some reason it likes to show one text box but not
the other. So what I did was put a rectangle over the "non-showing" text
box, gave it a VBA name, and ran code to set its visible property to FALSE
when I click the button. That worked!

BRING ON PPT 2010!

Bill Foley
 
D

David Marcovitz

I think the problem with Steve's code is that it is made to work if the
shape starts visible and needs to be made invisible. You are trying to
do the opposite so I don't think his code will help. You could start
with the shapes visible, then before going to the slide, make them
invisible (with Steve's or similar code). From that point on it should work.
--David

Well, Steve's refresh method did nothing. So, for something as simple as
the code below, what would I have to do to make the Q1-1 object appear?

Sub Correct1_1()
ActivePresentation.Slides(3).Shapes("Q1-1").Visible = True
ActivePresentation.Slides(3).Shapes("P1-1").Visible = True
End Sub

Funny thing, the P1-1 object shows up fine (matter of fact I have 5 of these
and they all show up). However, the Q1-1 through Q1-5 do not!

What would I have to do to make this work in PPT 2007? Man, why did this
happen in the first place? But, more importantly HOW???

Any clues would be appreciated. I would even be happy to send the game file
to you (off-line).

TIA!

Bill Foley


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

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