Partager via


Shapes.AddMediaObject2 Method

Adds a new media object.

Namespace:  Microsoft.Office.Interop.PowerPoint
Assembly:  Microsoft.Office.Interop.PowerPoint (in Microsoft.Office.Interop.PowerPoint.dll)

Syntax

'Declaration
Function AddMediaObject2 ( _
    FileName As String, _
    LinkToFile As MsoTriState, _
    SaveWithDocument As MsoTriState, _
    Left As Single, _
    Top As Single, _
    Width As Single, _
    Height As Single _
) As Shape
'Usage
Dim instance As Shapes
Dim FileName As String
Dim LinkToFile As MsoTriState
Dim SaveWithDocument As MsoTriState
Dim Left As Single
Dim Top As Single
Dim Width As Single
Dim Height As Single
Dim returnValue As Shape

returnValue = instance.AddMediaObject2(FileName, _
    LinkToFile, SaveWithDocument, Left, _
    Top, Width, Height)
Shape AddMediaObject2(
    string FileName,
    MsoTriState LinkToFile,
    MsoTriState SaveWithDocument,
    float Left,
    float Top,
    float Width,
    float Height
)

Parameters

  • Left
    Type: System.Single
    The distance, in points, from the left edge of the slide to the left edge of the media object.
  • Top
    Type: System.Single
    The distance, in points, from the top edge of the slide to the top edge of the media object.
  • Width
    Type: System.Single
    The width, in points, of the media object. Default value is -1.
  • Height
    Type: System.Single
    The height, in points, of the media object. Default value is -1.

Return Value

Type: Microsoft.Office.Interop.PowerPoint.Shape

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

Reference

Shapes Interface

Shapes Members

Microsoft.Office.Interop.PowerPoint Namespace