AddPicture Method

Microsoft PowerPoint Visual Basic

object that represents the new picture.

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

expression    Required. An expression that returns one of the objects in the Applies To list.

FileName    Required String. The file from which the OLE object is to be created.

LinkToFile   Required MsoTriState. Determines whether the picture will be linked to the file from which it was created.

MsoTriState can be one of these MsoTriState constants.
msoCTrue
msoFalse Makes the picture an independent copy of the file.
msoTriStateMixed
msoTriStateToggle
msoTrue Links the picture to the file from which it was created.

SaveWithDocument Required MsoTriState. Determines whether the linked picture will be saved with the document into which it's inserted. This argument must be msoTrue if LinkToFile is msoFalse.

MsoTriState can be one of these MsoTriState constants.
msoCTrue
msoFalse Stores only the link information in the document.
msoTriStateMixed
msoTriStateToggle
msoTrue Saves the linked picture with the document into which it's inserted.

Left    Required Single. The position, measured in points, of the left edge of the picture relative to the left edge of the slide.

Top    Required Single. The position, measured in points, of the top edge of the picture relative to the top edge of the slide.

Width    Optional Single. The width of the picture, measured in points.

Height    Optional Single. The height of the picture, measured in points.

Example

This example adds a picture created from the file Music.bmp to myDocument. The inserted picture is linked to the file from which it was created and is saved with myDocument.

Set myDocument = ActivePresentation.Slides(1)
myDocument.Shapes.AddPicture FileName:="c:\microsoft office\" & _
    "clipart\music.bmp", LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, _
    Left:=100, Top:=100, Width:=70, Height:=70