Shapes.AddMediaObject Method

PowerPoint Developer Reference

Creates a media object. Returns a Shape object that represents the new media object.

Syntax

expression.AddMediaObject(FileName, Left, Top, Width, Height)

expression   A variable that represents a Shapes object.

Parameters

Name Required/Optional Data Type Description
FileName Required String Required String. The file from which the media object is to be created. If the path isn't specified, the current working folder is used.
Left Optional Single The position (in points) of the upper-left corner of the media object's bounding box relative to the upper-left corner of the document.
Top Optional Single The position (in points) of the upper-left corner of the media object's bounding box relative to the upper-left corner of the document.
Width Optional Single The width of the media object's bounding box, in points.
Height Optional Single The height of the media object's bounding box, in points.

Return Value
Shape

Example

This example adds the movie named "Clock.avi" to myDocument.

Visual Basic for Applications
  Set myDocument = ActivePresentation.Slides(1)
myDocument.Shapes.AddMediaObject FileName:="C:\Windows\clock.avi", _
    Left:=5, Top:=5, Width:=100, Height:=100

See Also