Shapes.AddPicture method (Excel)
Creates a picture from an existing file. Returns a Shape object that represents the new picture.
expression.AddPicture (FileName, LinkToFile, SaveWithDocument, Left, Top, Width, Height)
expression A variable that represents a Shapes object.
|FileName||Required||String||The file from which the picture is to be created.|
|LinkToFile||Required||MsoTriState||The file to link to. Use msoFalse to make the picture an independent copy of the file. Use msoTrue to link the picture to the file from which it was created.|
|SaveWithDocument||Required||MsoTriState||To save the picture with the document. Use msoFalse to store only the link information in the document. Use msoTrue to save the linked picture with the document into which it's inserted. This argument must be msoTrue if LinkToFile is msoFalse.|
|Left||Required||Single||The position (in points) of the upper-left corner of the picture relative to the upper-left corner of the document.|
|Top||Required||Single||The position (in points) of the upper-left corner of the picture relative to the top of the document.|
|Width||Required||Single||The width of the picture, in points (enter -1 to retain the width of the existing file).|
|Height||Required||Single||The height of the picture, in points (enter -1 to retain the height of the existing file).|
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
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.