Shapes.AddCanvas (Word)

Adds a drawing canvas to a document. Returns a Shape object that represents the drawing canvas and adds it to the Shapes collection.

AddCanvas (Left, Top, Width, Height, Anchor)


Sub AddInlineCanvas() 
 Dim docNew As Document 
 Dim shpCanvas As Shape 
 
 Set docNew = Documents.Add 
 
 'Add a drawing canvas to the new document 
 Set shpCanvas = docNew.Shapes.AddCanvas( _ 
 Left:=150, Top:=150, Width:=70, Height:=70) 
 shpCanvas.WrapFormat.Type = wdWrapInline 
 
 'Add shapes to drawing canvas 
 With shpCanvas.CanvasItems 
 .AddShape msoShapeHeart, Left:=10, _ 
 Top:=10, Width:=50, Height:=60 
 .AddLine BeginX:=0, BeginY:=0, _ 
 EndX:=70, EndY:=70 
 End With 
 With shpCanvas 
 .CanvasItems(1).Fill.ForeColor _ 
 .RGB = RGB(Red:=255, Green:=0, Blue:=0) 
 .CanvasItems(2).Line _ 
 .EndArrowheadStyle = msoArrowheadTriangle 
 End With 
End Sub

Arguments

The following arguments are required:

Left (Single) - The position, in points, of the left edge of the drawing canvas, relative to the anchor.

Top (Single) - The position, in points, of the top edge of the drawing canvas, relative to the anchor.

Width (Single) - The width, in points, of the drawing canvas.

Height (Single) - The height, in points, of the drawing canvas.

Optional arguments

The following argument is optional

Anchor (Range) - A Range object that represents the text to which the canvas 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, the anchoring range is selected automatically and the canvas is positioned relative to the top and left edges of the page.