AddPicture Method

Applies To

Shapes collection object.

Description

Creates a picture from an existing file. Returns a Shape object that represents the new picture.

Syntax

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

expression Required. An expression that returns a Shapes object.

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

LinkToFile Required Long. True to link the picture to the file from which it was created. False to make the picture an independent copy of the file.

SaveWithDocument Required Long. True to save the linked picture with the document into which it's inserted. False to store only the link information in the document. This argument must be True if LinkToFile is False.

Left, Top Required Single. The position (in points) of the upper-left corner of the picture relative to the upper-left corner of the document.

Width, Height Required Single. The width and height of the picture, 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 = Worksheets(1)
myDocument.Shapes.AddPicture "c:\microsoft office\clipart\music.bmp", _
    True, True, 100, 100, 70, 70