Shapes.AddPicture Method
Excel Developer Reference |
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
Name | Required/Optional | Data Type | Description |
---|---|---|---|
Filename | Required | String | The file from which the OLE object is to be created. |
LinkToFile | Required | MsoTriState | The file to link to. |
SaveWithDocument | Required | MsoTriState | To save the picture with the document. |
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. |
Height | Required | Single | The 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 |
---|
|
See Also