Shapes.AddMediaObject2 method (PowerPoint)

Replaces deprecated Shapes.AddMediaObject method (PowerPoint). Adds a new media object.

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

Shapes Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.