AddPicture Method

Applies To

InlineShapes collection object, Shapes collection object.

Description

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

InlineShapes object: Creates a picture from an existing file. Returns the InlineShape object that represents the new picture.

Syntax 1

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

Syntax 2

expression.AddPicture(FileName, LinkToFile, SaveWithDocument, Range)

expression Syntax 1: Required. An expression that returns a Shapes object.

Syntax 2: Required. An expression that returns an InlineShapes object.

FileName Required String. The file from which the object is to be created. If this argument is omitted, the current folder is used.

LinkToFile Optional Variant. True to link the picture to the file from which it was created. False to make the picture an independent copy of the file. The default value is False.

SaveWithDocument Optional Variant. True to save the linked picture with the document. The default value is False.

Left, Top Optional Variant. The position (in points) of the upper-left corner of the new picture relative to the anchor.

Width, Height Optional Variant. The width and height of the picture, in points.

Anchor Optional Variant. The range to which the picture is bound. If Anchor is specified, the anchor is positioned at the beginning of the first paragraph in the anchoring range. If this argument is omitted, however, the anchor is placed automatically and the picture is positioned relative to the top and left edges of the page.

Range Optional Variant. The range where the picture will be placed in the text. The picture replaces the range, if the range isn't collapsed. If this argument is omitted, the picture is placed automatically.

See Also

AddOLEControl method, AddOLEObject method.

Example

This example adds a new picture to myDoc. The inserted picture is linked to the file from which it was created and is saved with the document.

Set myDoc = ActiveDocument
ActiveDocument.Shapes.AddPicture _
    "C:\Program Files\Microsoft Office\Clipart\Music.bmp", True, True