vba ppt slide value

  • Thread starter Thread starter Lance Hoffmeyer
  • Start date Start date
L

Lance Hoffmeyer

Hey all,

Is there an absolute value (progid?) for each slide that will not change regardless
of whether a slide is added or dropped? I am running some VBA scripts that work based
on slide number but slides could be added or dropped each QTR and thus the slide number
for a particular slide could change.

If there is an absolute number for a slide that will not change

1) How do I determine this number via VBA?
2) How do I access this in a script?

instead of this how would I access the absolute value of the slide number?
Set oPPTShape = oPPTFile.Slides(33).Shapes("Object 2")

Thanks in advance,

Lance
 
Lance,
The SlideID is unique, it does not change.
MsgBox "The Slide ID of the current slide is:" & _
ActiveWindow.View.Slide.SlideID

To locate a slide using the slide you would use the FindByID method.
Set oSld = ActivePresentation.Slides.FindBySlideID(256)


--
Regards,
Shyam Pillai

Animation Carbon: Copy/Paste/Share animation libraries.
www.animationcarbon.com
 
If there is an absolute number for a slide that will not change

Not really Lance. Thats why I always write a number or descrition to a
slide tag. I know that isn't going to be changed.

Austin Myers
MS PowerPoint MVP Team

Provider of PFCPro, PFCMedia and PFCExpress
www.playsforcertain.com
 
Deleting a slide is not the problem.

However, since the ID number is only semi-unique, it is possible to run into
an instance where you paste a slide with ID 2048 (from another machine, for
example) into a presentation that already contains a slide ID 2048 (from
your machine). I don't know how PowerPoint resolves this issue, and don't
entirely trust it to do what I want it to in those cases. Your way works.

--
Bill Dilworth
A proud member of the Microsoft PPT MVP Team
Users helping fellow users.
http://billdilworth.mvps.org
 
Hmmm, never looked at this before Shyam. What happens if I delete slides?

The deleted slide goes away. The other slideIDs don't change as a result
though the SlideIndex and SlideNumber of any subsequent slides will decrement
by one.

If a slide with SlideID=x is deleted, that SlideID may be reused the next time
a slide is pasted in.

When you paste in a slide from another presentation, the current presentation's
SlideID scheme wins; the newly pasted slide will get a new SlideID, even if
there's no conflict.

Ex:
PresA has only one slide, SlideID=256
PresB has ten slides, 256 - 265

Copy slide 10 from PresB, paste into PresA, it becomes SlideID 257

I'm not certain of this, but PPT seems to maintain a "high water mark" for IDs.
If it's assigned 257 and no higher, it'll reassign 257 if you delete 257 and
add a new slide, but if you've added two new slides, making the high water mark
258, then delete 257, it won't reassign that number, it seems.

So once you grab a slide's ID within a given presentation, it's not going to
change. But a Slide ID is not unique across two presentations.
 
Austin,
Steve filled in with the details. It's a handy property which is mostly
reliable. There is a similar property ID for shapes which was introduced in
PPT 2002.


--
Regards,
Shyam Pillai

Animation Carbon: Copy/Paste/Share animation libraries.
www.animationcarbon.com
 
Back
Top