Share via


Delete Method

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 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 Microsoft Word document, Microsoft Excel worksheet, or Microsoft 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.

Delete method as it applies to the DocumentLibraryVersion object.

Removes a document library version from the DocumentLibraryVersions collection.

expression.Delete

*expression   * Required. An expression that returns a DocumentLibraryVersion object.

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 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 SharedWorkspace object.

Deletes the current shared workspace and all data within it.

expression.Delete

*expression   * Required. An expression that returns a SharedWorkspace object.

The Delete method will fail if the user does not have permission to delete the current shared workspace.

If the active document was opened directly from the workspace, then after deleting the workspace, the document will no longer be saved on disk. The developer must remember to save the document to a new location before closing it, or the document will cease to exist.

Deletes the current object.

expression.Delete

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

The Delete method will fail if the user does not have permission to delete the current object from the shared workspace.

Delete method as it applies to the SharedWorkspaceFolder object.

Deletes the current shared workspace folder and all data within it.

expression.Delete(DeleteEvenIfFolderContainsFiles)

*expression   * Required. An expression that returns a SharedWorkspaceFolder object.

*DeleteEvenIfFolderContainsFiles   * Optional Boolean. True to delete the folder without warning even if the folder contains files. Default is False.

The Delete method will fail if the user does not have permission to delete the current folder from the shared workspace.

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

Applies to | AnswerWizardFiles Collection Object | CommandBar Object | CommandBarButton Object | CommandBarComboBox Object | CommandBarControl Object | CommandBarPopup Object | DocumentLibraryVersion Object | DocumentProperty Object | FileDialogFilters Collection | ODSOFilters Object | Script Object | Scripts Collection Object | SharedWorkspace Object | SharedWorkspaceFile Object | SharedWorkspaceFolder Object | SharedWorkspaceLink Object | SharedWorkspaceMember Object | SharedWorkspaceTask Object | Signature Object