Add Method

Microsoft PowerPoint Visual Basic

Show All

Add Method

       

Add method as it applies to the AddIns object.

Returns an AddIn object that represents an add-in file added to the list of add-ins.

expression.Add(Filename)

expression   Required. An expression that returns an AddIns object.

Filename   Required String. The full name of the file (including the path and file name extension) that contains the add-in you want to add to the list of add-ins.

Remarks

This method doesn't load the new add-in. You must set the Loaded property to load the add-in.

Add method as it applies to the AnimationBehaviors object.

Returns an AnimationBehavior object that represents a new animation behavior.

expression.Add(Type, Index)

expression   Required. An expression that returns an AnimationBehaviors object.

Type  Required MsoAnimType. The behavior of the animation.

MsoAnimType can be one of these MsoAnimType constants.
msoAnimTypeColor
msoAnimTypeMixed
msoAnimTypeMotion
msoAnimTypeNone
msoAnimTypeProperty
msoAnimTypeRotation
msoAnimTypeScale

Index  Optional Long. The placement of the animation in relation to other animation behaviors. The default value is -1 which means that if the Index argument is omitted, the new animation behavior is added to the end of existing animation behaviors.

Add method as it applies to the AnimationPoints and Sequences objects.

Returns an AnimationPoint or Sequence object that represents a new animation point or sequence.

expression.Add(Index)

expression   Required. An expression that returns one of the above objects.

Index  Optional Long. The position of the animation point or sequence in relation to other animation points or sequences. The default value is -1 which means that if the Index argument is omitted, the new animation point or sequence is added to the end of existing animation points or sequence.

Add method as it applies to the ColorSchemes object.

Adds a color scheme to the collection of available schemes. Returns a ColorScheme object that represents the added color scheme.

expression.Add(Scheme)

expression   Required. An expression that returns a ColorSchemes object.

Scheme   Optional ColorScheme object. The color scheme to add. Can be a ColorScheme object from any slide or master, or an item in the ColorSchemes collection from any open presentation. If this argument is omitted, the first ColorScheme object (the first standard color scheme) in the specified presentation's ColorSchemes collection is used.

Remarks

The new color scheme is based on the colors used on the specified slide or master or on the colors in the specified color scheme from an open presentation.

The ColorSchemes collection can contain up to 16 color schemes. If you need to add another color scheme and the ColorSchemes collection is already full, use the Delete method to remove an existing color scheme.

Note that although Microsoft PowerPoint automatically checks whether a color scheme is a duplicate before adding it through the user interface, it doesn't check before adding a color scheme through a Visual Basic procedure. Your procedure must do its own checking to avoid adding redundant color schemes.

Add method as it applies to the Columns object.

Adds a new column to an existing table. Returns a Column object that represents the new table column.

expression.Add(BeforeColumn)

expression   Required. An expression that returns a Columns object.

BeforeColumn   Optional Long. The index number specifying the table column before which the new column will be inserted. This argument must be a Long from 1 to the number of columns in the table. The default value is -1 which means that if the BeforeColumn argument is omitted, then the new column is added as the last column in the table.

Add method as it applies to the Comments object.

Returns a Comment object that represents a new comment added to a slide.

expression.Add(Left, Top, Author, AuthorInitials, Text)

expression   Required. An expression that returns a Comments object.

Left  Required Single. The position, measured in points, of the left edge of the comment, relative to the left edge of the presentation.

Top  Required Single. The position, measured in points, of the top edge of the comment, relative to the top edge of the presentation.

Author  Required String. The author of the comment.

AuthorInitials  Required String. The author's initials.

Text  Required String. The comment's text.

Add method as it applies to the Designs object.

Returns a Design object that represents a new slide design.

expression.Add(designName, Index)

expression   Required. An expression that returns a Designs object.

designName  Required String. The name of the design.

Index  Optional Integer. The index number of the design. The default value is -1 which means that if the Index argument is omitted, then the new slide design is added at the end of existing slide designs.

Add method as it applies to the ExtraColors object.

Adds a color to the extra colors available to a presentation if the color hasn't already been added.

expression.Add(Type)

expression   Required. An expression that returns an ExtraColors object.

Type   Required MsoRGBType. The red-green-blue (RGB) value of the color to be added.

Add method as it applies to the NamedSlideShows object.

Creates a new named slide show and adds it to the collection of named slide shows in the specified presentation. Returns a NamedSlideShow object that represents the new named slide show.

expression.Add(Name, SafeArrayOfSlideIDs)

expression   Required. An expression that returns a NamedSlideShows object.

Name   Required String. The name of the slide show.

SafeArrayOfSlideIDs   Required Variant. Contains the unique slide IDs of the slides to be displayed in a slide show.

Remarks

The name you specify when you add a named slide show is the name you use as an argument to the Run method to run the named slide show.

Add method as it applies to the Presentations object.

Creates a presentation. Returns a Presentation object that represents the new presentation.

expression.Add(WithWindow)

expression   Required. An expression that returns a Presentations collection.

WithWindow  Optional MsoTriState. MsoTrue creates the presentation in a visible window.

MsoTriState can be one of these MsoTriState constants.
msoCTrue
msoFalse The new presentation isn't visible.
msoTriStateMixed
msoTriStateToggle
msoTrue Default. Creates the presentation in a visible window.

Add method as it applies to the PrintRanges object.

Returns a PrintRange object that represents a consecutive run of slides to be printed.

expression.Add(Start, End)

expression   Required. An expression that returns a PrintRanges object.

Start   Required Long. The first slide in the range of slides to be printed. Must be less than or equal to the value of the End argument.

End   Required Long. The last slide in the range of slides to be printed. Must be greater than or equal to the value of the Start argument.

Remarks

The RangeType property of the PrintOptions object must be set to ppPrintSlideRange for the ranges in the PrintRanges collection to be applied.

If you don't want to print an entire presentation, add print ranges to specify which slides you want to print. You must add one print range for each consecutive run of slides to be printed. For example, if you want to print slide 1, slides 3 through 5, and slides 8 and 9, you must add three print range objects. For more information, see the example for this method.

Use the ClearAll method to clear previously-defined print ranges.

Add method as it applies to the Rows object.

Returns a Row object that represents a new row added to an existing table.

expression.Add(BeforeRow)

expression   Required. An expression that returns a Rows object.

BeforeRow  Optional Long. The index number specifying the table row before which the new row will be inserted. This argument must be an integer value from 1 to the number of rows in the table. The default value is -1 which means that if the BeforeRow argument is omitted, then the new row is added as the last row in the table.

Add method as it applies to the Slides object.

Creates a new slide and adds it to the collection of slides in the specified presentation. Returns a Slide object that represents the new slide.

expression.Add(Index, Layout)

expression   Required. An expression that returns a Slides collection.

Index   Required Long. The index number the new slide will have within the Slides collection. This value cannot exceed the number of existing slides + 1.  If set to 1, the new slide becomes the first slide in the presentation.

Layout  Required PpSlideLayout. The type of slide to create.

PpSlideLayout can be one of these PpSlideLayout constants.
ppLayoutBlank
ppLayoutChart
ppLayoutChartAndText
ppLayoutClipartAndText
ppLayoutClipArtAndVerticalText
ppLayoutFourObjects
ppLayoutLargeObject
ppLayoutMediaClipAndText
ppLayoutMixed
ppLayoutObject
ppLayoutObjectAndText
ppLayoutObjectOverText
ppLayoutOrgchart
ppLayoutTable
ppLayoutText
ppLayoutTextAndChart
ppLayoutTextAndClipart
ppLayoutTextAndMediaClip
ppLayoutTextAndObject
ppLayoutTextAndTwoObjects
ppLayoutTextOverObject
ppLayoutTitle
ppLayoutTitleOnly
ppLayoutTwoColumnText
ppLayoutTwoObjectsAndText
ppLayoutTwoObjectsOverText
ppLayoutVerticalText
ppLayoutVerticalTitleAndText
ppLayoutVerticalTitleAndTextOverChart

Remarks

To alter the layout of an existing slide, use the Layout property.

Add method as it applies to the TabStops object.

Adds a tab stop to the ruler for the specified text. Returns a TabStop object that represents the new tab stop.

expression.Add(Type, Position)

expression   Required. An expression that returns a TabStops collection.

Type  Required PpTabStopType. Specifies the way text will be aligned with the new tab stop.

PpTabStopType can be one of these PpTabStopType constants.
ppTabStopCenter
ppTabStopDecimal
ppTabStopLeft
ppTabStopMixed
ppTabStopRight

Position   Required Single. The position of the new tab stop, in points.

Add method as it applies to the Tags object.

Creates a tag for the specified object. If the tag already exists, this method replaces the existing tag value.

expression.Add(Name, Value)

expression   Required. An expression that returns a Tags object.

Name   Required String. The new tag name. Use "name" as the string for this argument to set the value of the name tag.

Value   Required String. The new tag value.

Remarks

The Tags object contains a pair of strings — the tag name and the tag value — for each tag. Use the Add method to create a tag, and use the Name and Value methods to return a tag's name and value components.

Example

As it applies to the AddIns object.

This example adds MyTools.ppa to the list of add-ins.

Set myAddIn = Application.AddIns.Add(FileName:="c:\my documents\mytools.ppa")
MsgBox myAddIn.Name & " has been added to the list"

As it applies to the ColorSchemes object. 

This example adds a new color scheme to the collection of standard color schemes for the active presentation. The new color scheme is based on the colors used in slide two in the active presentation.

With ActivePresentation
    Set newClrScheme = .Slides(2).ColorScheme
    .ColorSchemes.Add Scheme:=newClrScheme
End With

As it applies to the Columns object. 

This example creates a new column before column one in the table represented by shape five on slide two. It then sets the width of the new column to 72 points (one inch).

With ActivePresentation.Slides(2).Shapes(5).Table
    .Columns.Add(1).Width = 72
End With

As it applies to the NamedSlideShows object. 

This example adds to the active presentation a named slide show Quick Show that contains slides 2, 7, and 9. The example then runs this slide show.

Dim qSlides(1 To 3) As Long
With ActivePresentation
    With .Slides
        qSlides(1) = .Item(2).SlideID
        qSlides(2) = .Item(7).SlideID
        qSlides(3) = .Item(9).SlideID
    End With
    With .SlideShowSettings
        .NamedSlideShows.Add Name:="Quick Show", SafeArrayOfSlideIDs:=qSlides
        .RangeType = ppShowNamedSlideShow
        .SlideShowName = "Quick Show"
        .Run
    End With
End With

As it applies to the Presentations object.

This example creates a presentation, adds a slide to it, and then saves the presentation.

With Presentations.Add
    .Slides.Add Index:=1, Layout:=ppLayoutTitle
    .SaveAs "Sample"
End With

As it applies to the PrintRanges object.

This example clears any previously defined print ranges and then prints slide 1, slides 3 through 5, and slides 8 and 9 in the active presentation.

With ActivePresentation.PrintOptions
    .RangeType = ppPrintSlideRange
    With .Ranges
        .ClearAll
        .Add Start:=1, End:=1
        .Add Start:=3, End:=5
        .Add Start:=8, End:=9
    End With
End With
ActivePresentation.PrintOut

As it applies to the Rows object.

This example creates a row at the end of an existing table and sets the height of the new row to 54 points (.75 inches).

With ActivePresentation.Slides(2).Shapes(5).Table
    .Rows.Add.Height = 54
End With

As it applies to the Slides object.

This example adds a slide that contains a title placeholder at the beginning of the active presentation.

ActivePresentation.Slides.Add Index:=1, Layout:=ppLayoutTitleOnly

This example adds a blank slide at the end of the active presentation.

With ActivePresentation.Slides
    .Add Index:=.Count + 1, Layout:=ppLayoutBlank
End With

As it applies to the TabStops object.

This example sets a left-aligned tab stop at 2 inches (144 points) for the text in shape two on slide one in the active presentation.

Application.ActivePresentation.Slides(1).Shapes(2).TextFrame _
    .Ruler.TabStops.Add Type:=ppTabStopLeft, Position:=144

As it applies to the Tags object.

This example adds a tag named Priority and sets the value of the name tag for slide one in the active presentation.

With Application.ActivePresentation.Slides(1).Tags
    'Sets value for name tag
    .Add Name:="Name", Value:="New Figures"
    'Adds "Priority" tag with value "Low"
    .Add Name:="Priority", Value:="Low"
End With

As it applies to the ExtraColors object. 

This example adds an extra color to the active presentation (if the color hasn't already been added).

ActivePresentation.ExtraColors.Add RGB(Red:=69, Green:=32, Blue:=155)