Partager via


Shapes.AddMediaObject2 Method (PowerPoint)

Adds a new media object.

Version Information

Version Added: PowerPoint 2010

Syntax

expression .AddMediaObject2(FileName, LinkToFile, SaveWithDocument, Left, Top, Width, Height)

expression A variable that represents a Shapes object.

Parameters

Name

Required/Optional

Data Type

Description

FileName

Required

String

The name of the file to be added.

LinkToFile

Optional

[MSOTRISTATE]

Indicates whether to link to the file.

SaveWithDocument

Optional

[MSOTRISTATE]

Indicates whether to save the media with the document.

Left

Optional

Single

The distance, in points, from the left edge of the slide to the left edge of the media object.

Top

Optional

Single

The distance, in points, from the top edge of the slide to the top edge of the media object.

Width

Optional

Single

The width, in points, of the media object. Default value is -1.

Height

Optional

Single

The height, in points, of the media object. Default value is -1.

Return Value

Shape object

Remarks

The default value varies depending whether the new media is an audio or video file, and on file size. If both LinkToFile and SaveWithDocument are False, this method returns an error. At least one must be True. Note that the object model allows an object to be both linked and embedded, which is not allowed through the user interface (UI).

See Also

Concepts

Shapes Object Members

Shapes Object