AddMediaObject Method

Microsoft PowerPoint Visual Basic

AddMediaObject Method

       

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

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

expression   Required. An expression that returns a Shapes object.

FileName   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, 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, Height   Optional Single. The width and height of the media object's bounding box, in points.

Example

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

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