changing slides

B

Bill DaTutor

I calculate data for 7 days and I have a different slide for each day. I
tried to use
... .Slides(i).Select but this is only good for the slide info for the 7
slides..

How do I activate or show a different slide for the data for each day?
 
D

David M. Marcovitz

Are you just trying to jump to different slides? Are you trying to do this
in Normal View or Slide Show View?
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

=?Utf-8?B?QmlsbCAgICBEYVR1dG9y?= <Bill
(e-mail address removed)> wrote in
 
B

Bill DaTutor

I am in normal view and I want to run a macro to read an input file and then
draw boxes and lines on differeent slides depending on the day the simulation
is running.
 
D

David M. Marcovitz

I'm still not entirely sure what you want to do, and I'm not sure why
you need to go to the slide. The following will go to a different slide
based on the day of the week:

Sub GotoDayOfWeek()
Select Case Weekday(Date)
Case 1
ActivePresentation.Slides(2).Select
Case 2
ActivePresentation.Slides(3).Select
Case 3
ActivePresentation.Slides(4).Select
Case 4
ActivePresentation.Slides(5).Select
Case 5
ActivePresentation.Slides(6).Select
Case 6
ActivePresentation.Slides(7).Select
Case 7
ActivePresentation.Slides(8).Select
End Select
End Sub

However, instead of the ActivePresentation.Slides(#).Select, why don't
you just use the number to draw your shapes, such as:

ActivePresentation.Slides(#).Shapes.AddTextbox ...

--David
 
B

Bill DaTutor

I tried :
ActivePresentation.Slides(Slide_Num).Shapes. _
AddShape(msoShapeRectangle, Left, vertical, Time, 7#).Select

where Slide_Num is defined in the main loop and has scope over all the module.
It prints all the objects for day 1 but for the first input of day 2 it
stops. If I press Debug, it goes to the above line and Slide_Num has a value
of 2 but I get the following error message:
Shape(unknown member): Invalid request. To select ashape, its
view must be active.

I am using PowerPoint 2000. Thanks for your time.
 
D

David M. Marcovitz

What happens if you leave off the parentheses for AddShape and cut out
..Select?
--David
 
B

Bill DaTutor

Thanks it did work without the parenthesis (but that is how it is in the help
file)
I still have a problem though because it is now nnot selected so I can not
change nay of its properties. How do I make it selected. Please and Thank
you.

Steve Rindsberg said:
Bill DaTutor
 
D

David M. Marcovitz

Yes, the parentheses issue is a weird one. When you put parentheses
around the parameters of a function, VBA is expecting the function to
return a value. When you leave off the parentheses, no value is
returned. Thus, when you add a shape with the parentheses, you need to
return some kind of value. You could do something like:

Dim oShp As Shape

Set oShp = ActivePresentation.Slides(#).Shapes.AddTextbox(...)

Then, you can do whatever you want with the shape by using oShp... For
example, oShp.TextFrame.TextRange.Text = "Hello"

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/

Thanks it did work without the parenthesis (but that is how it is in
the help file)
I still have a problem though because it is now nnot selected so I can
not change nay of its properties. How do I make it selected. Please
and Thank you.
 
B

Bill DaTutor

You hit it on the head . Many Thanks, I will drink a beer to your health.

Bill DaTutor said:
Thanks it did work without the parenthesis (but that is how it is in the help
file)
I still have a problem though because it is now nnot selected so I can not
change nay of its properties. How do I make it selected. Please and Thank
you.
 

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