CanvasShapes.AddPicture Method (Word)
Adds a picture to a drawing canvas. Returns a Shape object that represents the picture and adds it to the CanvasShapes collection.
Syntax
expression .AddPicture(FileName, LinkToFile, SaveWithDocument, Left, Top, Width, Height)
expression Required. A variable that represents a CanvasShapes collection.
Parameters
Name |
Required/Optional |
Data Type |
Description |
---|---|---|---|
FileName |
Required |
String |
The path and file name of the picture. |
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 |
Optional |
Variant |
The position, measured in points, of the left edge of the new picture relative to the drawing canvas. |
Top |
Optional |
Variant |
The position, measured in points, of the top edge of the new picture relative to the drawing canvas. |
Width |
Optional |
Variant |
The width of the picture, in points. |
Height |
Optional |
Variant |
The height of the picture, in points. |
Example
This example adds a picture to a newly created drawing canvas in the active document.
Sub NewCanvasPicture()
Dim shpCanvas As Shape
'Add a drawing canvas to the active document
Set shpCanvas = ActiveDocument.Shapes _
.AddCanvas(Left:=100, Top:=75, _
Width:=200, Height:=300)
'Add a graphic to the drawing canvas
shpCanvas.CanvasItems.AddPicture _
FileName:="C:\Program Files\Microsoft Office\" & _
"Office\Bitmaps\Styles\stone.bmp", _
LinkToFile:=False, SaveWithDocument:=True
End Sub