Delete Method

         Example         Applies To         Specifics

Deletes the specified object from its collection.

Syntax 1

expression.Delete

Syntax 2

expression.Delete(Temporary)

Syntax 3

expression.Delete(Filename)

expression   Required. An expression that returns a CommandBar or DocumentProperty object (Syntax 1), a CommandBarControl object (Syntax 2), or an AnswerWizardFiles object (Syntax 3).

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

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

Remarks

You cannot delete a built-in document property.

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.