Shapes.AddMediaObject2 (PowerPoint)

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

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).

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


Dim strFileName As String: strFileName = 
Dim shpAddMediaObject2 As Shape
Set shpAddMediaObject2 = ActivePresentation.SlideMaster.Shapes.AddMediaObject2(FileName:=strFileName)

Arguments

The following argument is required

FileName (String) - The name of the file to be added.

Optional arguments

The following arguments are optional

LinkToFile (Office.MsoTriState) - Indicates whether to link to the file.

SaveWithDocument (Office.MsoTriState) - Indicates whether to save the media with the document.

Left (Single) - The distance, in points, from the left edge of the slide to the left edge of the media object.

Top (Single) - The distance, in points, from the top edge of the slide to the top edge of the media object.

Width (Single) - The width, in points, of the media object. Default value is -1.

Height (Single) - The height, in points, of the media object. Default value is -1.