Can someone provide code snippets on how to create a Line or Rectangle
in Microsoft Word using interop or .net calls? I'm not interested in
using Word Macros.
Sub AddCanvasShapes()
Dim shpCanvas As Shape
Dim shpCanvasShapes As CanvasShapes
Dim shpCnvItem As Shape
'Adds a new canvas to the document
Set shpCanvas = ActiveDocument.Shapes _
.AddCanvas(Left:=100, Top:=75, _
Width:=50, Height:=75)
Set shpCanvasShapes = shpCanvas.CanvasItems
'Adds shapes to the CanvasShapes collection
With shpCanvasShapes
.AddShape Type:=msoShapeRectangle, _
Left:=0, Top:=0, Width:=50, Height:=50
.AddShape Type:=msoShapeOval, _
Left:=5, Top:=5, Width:=40, Height:=40
.AddShape Type:=msoShapeIsoscelesTriangle, _
Left:=0, Top:=25, Width:=50, Height:=50
End With
End Sub
Sub CanvasShapeThree()
With ActiveDocument.Shapes(1).CanvasItems(3)
.Line.ForeColor.RGB = RGB(50, 0, 255)
.Fill.ForeColor.RGB = RGB(50, 0, 255)
.Flip msoFlipVertical
End With
End Sub