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

Application Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.