Partager via


Application.OrganizerDelete Method (Word)

Deletes the specified style, AutoText entry, toolbar, or macro project item from a document or template.

Syntax

expression .OrganizerDelete(Source, Name, Object)

expression Required. A variable that represents an Application object.

Parameters

Name

Required/Optional

Data Type

Description

Source

Required

String

The file name of the document or template that contains the item you want to delete.

Name

Required

String

The name of the style, AutoText entry, toolbar, or macro you want to delete.

Object

Required

WdOrganizerObject

The kind of item you want to copy.

Example

This example deletes the toolbar named "Custom 1" from the Normal template.

Dim cbLoop As CommandBar 
 
For Each cbLoop In CommandBars 
 If cbLoop.Name = "Custom 1" Then 
 Application.OrganizerDelete Source:=NormalTemplate.Name, _ 
 Name:="Custom 1", _ 
 Object:=wdOrganizerObjectCommandBars 
 End If 
Next cbLoop

This example prompts the user to delete each AutoText entry in the template attached to the active document. If the user clicks the Yes button, the AutoText entries are deleted.

Dim atEntry As AutoTextEntry 
Dim intResponse As Integer 
 
For Each atEntry In _ 
 ActiveDocument.AttachedTemplate.AutoTextEntries 
 intResponse = _ 
 MsgBox("Do you want to delete the " & atEntry.Name _ 
 & " AutoText entry?", vbYesNoCancel) 
 If intResponse = vbYes Then 
 With ActiveDocument.AttachedTemplate 
 Application.OrganizerDelete _ 
 Source:= .Path & "\" & .Name, _ 
 Name:=atEntry.Name, _ 
 Object:=wdOrganizerObjectAutoText 
 End With 
 ElseIf intResponse = vbCancel Then 
 Exit For 
 End If 
Next atEntry

See Also

Concepts

Application Object Members

Application Object