Delete Method

Microsoft Office Object Model

Show All

Delete Method

       

Delete method as it applies to the DocumentProperty object.

Removes a custom document property.

expression.Delete

expression   Required. An expression that returns one of the above objects.

Remarks

You cannot delete a built-in document property.

Delete method as it applies to the AnswerWizardFiles object.

Deletes the specified object from its collection.

expression.Delete(FileName)

expression   Required. An expression that returns one of the above objects.

FileName  Required String. The name of the file to be deleted, including the fully-qualified path, file name, and extension.

Delete method as it applies to the FileDialogFilters object.

Removes a file dialog filter.

expression.Delete(filter)

expression   Required. An expression that returns one of the above objects.

filter  Optional Variant. The filter to be removed.

Delete method as it applies to the ODSOFilters object.

Deletes a filter object from the ODSOFilters collection.

expression.Delete(Index, DeferUpdate)

expression   Required. An expression that returns one of the above objects.

Index  Required Long. The number of the filter to delete.

DeferUpdate  Optional Boolean.

Delete method as it applies to the CommandBar, Script, Scripts, and Signature objects.

Deletes the specified object from the collection.

expression.Delete

expression   Required. An expression that returns one of the above objects.

Remarks

For the Scripts collection, using the Delete method removes all scripts from the specified Word document, Excel worksheet, or PowerPoint slide. A script anchor is represented by a shape in the host application. Therefore, the Shape object associated with each script anchor of type msoScriptAnchor is deleted from the Shapes collection in Excel and PowerPoint and from the InlineShapes and Shapes collections in Word.

Delete method as it applies to the CommandBarButton, CommandBarComboBox, CommandBarControl, and CommandBarPopup objects.

Deletes the specified object from its collection.

expression.Delete(Temporary)

expression   Required. An expression that returns one of the above objects.

Temporary  Optional Variant. True to delete the control for the current session. The application will display the control again in the next session.

Example

As it applies to the CommandBar object.

This example deletes all custom command bars that aren't visible.

foundFlag = False
delBars = 0
For Each bar In CommandBars
    If (bar.BuiltIn = False) And _
    (bar.Visible = False) Then
        bar.Delete
        foundFlag = True
        delBars = delBars + 1
    End If
Next bar
If Not foundFlag Then
    MsgBox "No command bars have been deleted."
Else
    MsgBox delBars & " custom bar(s) deleted."
End If

As it applies to the DocumentProperty object.

This example deletes a custom document property. For this example to run properly, you must have a custom DocumentProperty object named "CustomNumber".

ActiveDocument.CustomDocumentProperties("CustomNumber").Delete