Adds a drawing canvas to a document. Returns a Shape object that represents the drawing canvas and adds it to the Shapes collection.
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
The following arguments are required:
The following argument is optional
Anchor - 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