Export (0) Print
Expand All

Shapes.AddPicture Method

Office 2007
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   A variable that represents a Shapes object.

Parameters

NameRequired/OptionalData TypeDescription
FilenameRequiredStringThe file from which the OLE object is to be created.
LinkToFileRequiredMsoTriState The file to link to.
SaveWithDocumentRequiredMsoTriStateTo save the picture with the document.
LeftRequiredSingleThe position (in points) of the upper-left corner of the picture relative to the upper-left corner of the document.
TopRequiredSingleThe position (in points) of the upper-left corner of the picture relative to the top of the document.
WidthRequiredSingleThe width of the picture, in points.
HeightRequiredSingleThe height of the picture, in points.

Return Value
Shape

Remarks

MsoTriState can be one of these MsoTriState constants.
msoCTrue
msoFalse To make the picture an independent copy of the file.
msoTriStateMixed
msoTriStateToggle
msoTrue To link the picture to the file from which it was created.
MsoTriState can be one of these MsoTriState constants.
msoCTrue
msoFalse To store only the link information in the document.
msoTriStateMixed
msoTriStateToggle
msoTrue To save the linked picture with the document into which it’s inserted. This argument must be msoTrue if LinkToFile is msoFalse.

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.

Visual Basic for Applications
Set myDocument = Worksheets(1)
myDocument.Shapes.AddPicture _
    "c:\microsoft office\clipart\music.bmp", _
    True, True, 100, 100, 70, 70



Community Additions

ADD
Show:
© 2014 Microsoft