Clear Method

Microsoft Word Visual Basic

expression.Clear

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

ShowAs it applies to the TabStop object.

This example clears the first custom tab in the first paragraph of the active document.

ActiveDocument.Paragraphs(1).TabStops(1).Clear
				

ShowAs it applies to the TextInput object.

This example protects the document for forms and deletes the text from the first form field if the field is a text form field.

ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
If ActiveDocument.FormFields(1).Type = wdFieldFormTextInput Then
    ActiveDocument.FormFields(1).TextInput.Clear
End If
				

ShowAs it applies to the ListEntries object.

This example removes all items from the form field named "Colors" in Sales.doc.

Documents("Sales.doc").FormFields("Colors") _
    .DropDown.ListEntries.Clear
				

ShowAs it applies to the DropCap object.

This example removes dropped capital letter formatting from the first letter in the active document.

Set drop = ActiveDocument.Paragraphs(1).DropCap
If Not (drop Is Nothing) Then drop.Clear
				

ShowAs it applies to the KeyBinding object.

This example removes the ALT+F1 key assignment from the Normal template.

CustomizationContext = NormalTemplate
FindKey(BuildKeyCode(Arg1:=wdKeyAlt, Arg2:=wdKeyF1)).Clear