Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
137 views3 pages

Excel VBA Shapes.AddPicture Guide

The Shapes.AddPicture method in Excel creates a picture from an existing file and returns a Shape object representing the new picture. It requires parameters for the file name, whether to link to the file, save with the document, and coordinates for position and size. An example adds a picture linked and saved with a document using parameters for the file path, link, save, and left, top, width and height values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
137 views3 pages

Excel VBA Shapes.AddPicture Guide

The Shapes.AddPicture method in Excel creates a picture from an existing file and returns a Shape object representing the new picture. It requires parameters for the file name, whether to link to the file, save with the document, and coordinates for position and size. An example adds a picture linked and saved with a document using parameters for the file path, link, save, and left, top, width and height values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Shapes.AddPicture method (Excel) | Microsoft Docs https://docs.microsoft.com/en-us/office/vba/api/excel.shapes.

addpicture

Shapes.AddPicture method (Excel)


05/15/2019 • 2 minutes to read • +1

In this article
Syntax
Parameters
Return value
Example

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


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

1 of 3 11/25/2020, 2:29 PM
Shapes.AddPicture method (Excel) | Microsoft Docs https://docs.microsoft.com/en-us/office/vba/api/excel.shapes.addpicture

Name Required/Optional Data type Description

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).

Return value
Shape

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.

VB Copy

Set myDocument = Worksheets(1)


myDocument.Shapes.AddPicture _

2 of 3 11/25/2020, 2:29 PM
Shapes.AddPicture method (Excel) | Microsoft Docs https://docs.microsoft.com/en-us/office/vba/api/excel.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.

Is this page helpful?

Yes No

3 of 3 11/25/2020, 2:29 PM

You might also like