PowerPoint animations are part of the slide object.

Animation Effects are assigned to shapes, but they are parts of an animation Timeline that is part of a slide.

Animations are set with timings within a slide. An animation can't continue to another slide.


The Animation Pane is displayed for a slide. To see this. slides.


Set variables for the slide object



We added Dim statements to declare the variables for two slides. We named them slid1 and slid2.

When you open a new powerpoint presentation there is always one slide.

If you open an existing presentation, there can be many slides already created.


The first Set statement is used for an existing slide.

We are assigning the variable slid1 to the existing Slide Index 1.


We can set the variable to any slide by using its index.

This will reference the slide at index (position) 5.

* Powerpoint automatically indexes numbers each slide.
* In this example we are referencing the slide at Index 1.
* As slides are added and deleted, the index numbers are reassigned.

The second Set statement is used to create a NEW slide.

If there were 10 slides and we wanted to add a slide to the 7th in the presentation, we would write:

The rest of the slides below 7 will be renumbered.

If we Add a slide at position 1, then the original slide with index of 1 is moved down to position 2.


In this case we are Adding a slide to the Slides collection of the Presentation named pres.

That is why you see the plural Slides in the statement.


AddSlides
Slide Index

If there are 5 slides, and we add a slide with an index of "3", then the new slide will be placed as the third slide.

The rest of the slides after 3 will be renumbered.

The index number in the Add statement is useful for positioning the slide as it is created.

However, since index numbers are reassigned as slides are added and removed, you should not count on index numbers to identify specific slides.



AddSlides

Layout

In addition to assigning an index, you must assign a Layout to a new slide.

In this example, we have used ppLayoutBlank. This will create a blank slide.

Other possible layouts include ppLayoutText, ppLayoutChart, ppLayouttextAndClipArt or ppLayoutObjectAndText.



Referencing a Existing Slide


Slide index numbers are renumbered when slides are added, deleted or moved.

Therefore, it is better practice to refer to the name instead of the index.


Naming a new slide


This assigns the name MySlide to the slide index number 3 that we just added.

The slideID is still 261 and will always be. The name is now MySlide instead of slide6.

AddSlides

The slide name or the slide index can be used to refer to the slide.



Both of the these statement are the same.




The name will always stay the same.

The index may change if other slides are added or removed.

Therefore, it is better practice to refer to the name instead of the index.




Slide Properties

There are several properties that apply to slides that are useful for the VBA programmer.



Layout

This is the layout assigned to a new slide when it is created.

PowerPoint requires a layout to be assigned to any new slide.

You can use ppLayoutBlank if you don't want to use a layout.




Name

This assigns a name to a slide.





SlideIndex

This property returns the index number of a slide.

This is a read-only value. You cannot change it.




The value of x will be the index number.


SlideID

All slides have a unique ID.

This is NOT the same as the slide index.



x = sld1.SlideID

The Slide ID is read-only.

You can't assign a SlideId value, you can only retreive the ID value.

In this example, x will contain the ID number.

Unlike an index number, the SlideID will never change.


SlideNumber

The slide number is the number that will appear on the lower-right corner of the slide when displayed.
This is a read-only value.

x = sld1.SlideNumber



Slide Methods

Copy



Cut



Paste


Paste refers to the slide from the clipboard. The clipboard Copy (or Cut) is part of the slides collection. It doesn't have a variable assigned in the clipboard. There can only be one slide in the clipboard. If you paste from the slides collection, it can only be the slide on the clipboard. In the above example, you can PASTE a slide to a specific position.
The index number is where the slide is to be pasted. If a position, (index), is not specified, the slide will be pasted as the last slide of the presentation.


Duplicate


This will create a duplicate of the slide referenced as sld1.

The duplicated slide will appear right after the original slide.



MoveTo


Move the slide to the 5th position in the presentation.



Delete









Copyright © 2006-2024, LQSystems,Inc. All rights reserved.