Find Current Slide Number

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

There was VBA Code suggested to find the current page number of a open power
point.

They had: SlideShowWindows(1).View.Slide.SlideIndex

I tried the same thing and got an error:

I am using PowerPoint 2000 sp3

This is my code:
Set oPPT = GetObject(, "PowerPoint.Application")

sn = oPPT.SlideShowWindows(1).View.Slide.SlideIndex

The error I get is:
"SlideShowWindows (Unknow member): Integer outof range. 1 is not in the
valid range of 1 to 0.

Can someone help!!!

Gary
 
One of the more expert VBA people will probably be able to help you
better, but it appears that you are getting an instance of the PowerPoint
application, but not opening any presentations, oPPT.SlideShowWindows
would be empty--i.e., there are no slide show windows. Maybe you can give
us a better idea of what you are trying to do. Is this code supposed to
be run from within PowerPoint?
--David

--
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/
 
You are correct. I am not doing a slide show. All I have is just power
point open with the slide selection on my left side and the main screen has
the selected slide. I think the view is called normal.

I am trying to find the current slide number that was selected to design
because when I open the embed ole object (Visio), it chages size on me (Visio
MVP thinks its an issue because other have seen this too). I need to know
the slide(index) to scaleheight and scalewidth using VBA Code. I tried using
fix numbers and it changes the slide that I indicate with the number.

If I can find out the slide number selected, then I can rescale my embed
drawing.

I could use all the help I can get.

Thank You,

Gary
 
OK. This is what you need:

mySlideIndex = ActiveWindow.Selection.SlideRange(1).SlideIndex

The reason why the original code didn't work is that it was designed for
Slide Show View, and you are running in Normal/Edit View. This line of
code will work in Normal/Edit View.

--David

--
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 think I am still doing something wrong here.

I am writing this VBA Code inside the embed Visio Drawing after its been
open. The Power Point is not active, but the visio is active.

The code I used:

myslideIndex = PowerPoint.ActiveWindow.Selection.sliderange(1).SlideIndex

It return empty because I think its not an ActiveWindow, while Visio is
active.

How do I reference an open and not active window???

Thank You Very Much,

Gary
 
I suspect you are right about what your problem is, but I will have to
cede to higher authorities because I do not use Visio, and I do not know
how it is interacting with PowerPoint.
--David

--
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/
 
How about working in Power point instead of Visio???

The reason I pick Visio, was that I could control event.

I created the power point from vba code using Access vba.

The problem I am trying to solve is to resize the embed drawing in power
point. I have done resizing in power point using the ScaleWidth and
ScaleHeight. The problem is how do I activate my VBA Code in Power Point to
detect the event that the embed object has closed??? In addition, I need
to have the ability to put this code or reference this code by VBA generated
power points.

Do you have any suggestions??

Thanks,

Gary
 
I think I am still doing something wrong here.

I am writing this VBA Code inside the embed Visio Drawing after its been
open. The Power Point is not active, but the visio is active.

The code I used:

myslideIndex = PowerPoint.ActiveWindow.Selection.sliderange(1).SlideIndex

It return empty because I think its not an ActiveWindow, while Visio is
active.

How do I reference an open and not active window???


What exactly do you want to accomplish? If you want to change one of
PowerPoint's shape attributes, why try to do it while the object is open in
Visio?
 
There is currently a problem with Visio when you sized it to fit a power
point slide and the original visio drawing is smaller. When you open the
visio drawing, and do some changes, the exit back to powerpoint, Visio
drawing go back to the original size of the Visio drawing instead of the
resized one that was done in power point earlier.

I was first thinking of doing this in Vsio except I can't figure how to find
the slide number of the power point slide in Normal/edit view and its not
active because Visio is currently active.


If you have suggestion on me determine the slide number that will work.

Or is there a way to pass parameters from power point to visio???


Thank You,

Gary
 
There is currently a problem with Visio when you sized it to fit a power
point slide and the original visio drawing is smaller. When you open the
visio drawing, and do some changes, the exit back to powerpoint, Visio
drawing go back to the original size of the Visio drawing instead of the
resized one that was done in power point earlier.

I was first thinking of doing this in Vsio except I can't figure how to find
the slide number of the power point slide in Normal/edit view and its not
active because Visio is currently active.

If you have suggestion on me determine the slide number that will work.

Not a clue how to do this from w/in Visio but you should be able to automate
Visio from w/in PPT.

With ActiveWindow.Selection.ShapeRange(1).Oleformat.Object
' code to manipulate the visio object here
End with
 

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

Back
Top