CanvasShapes.Count property (Word)

Returns a Long that represents the number of canvas shapes in the specified collection. Read-only.

Syntax

expression.Count

expression Required. A variable that represents a CanvasShapes object.

Example

This example displays the number of paragraphs in the active document.

MsgBox "The active document contains " & _ 
 ActiveDocument.Paragraphs.Count & " paragraphs."

This example displays the number of words in the selection.

If Selection.Words.Count >= 1 And _ 
 Selection.Type <> wdSelectionIP Then 
 MsgBox "The selection contains " & Selection.Words.Count _ 
 & " words." 
End If

This example uses the aFields() array to store the field codes in the active document.

fcount = ActiveDocument.Fields.Count 
If fcount >= 1 Then 
 ReDim aFields(fcount) 
 For Each aField In ActiveDocument.Fields 
 aFields(aField.Index) = aField.Code.Text 
 Next aField 
End If

See also

CanvasShapes Collection

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.