OrganizerDelete Method
Applies To
Application object.
Description
Deletes the specified style, AutoText entry, toolbar, or macro project item from a document or template.
Syntax
expression.OrganizerDelete(Source, Name, Object)
expression Required. An expression that returns an Application object.
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 Long. The kind of item you want to copy. Can be one of the following WdOrganizerObject constants: wdOrganizerObjectAutoText, wdOrganizerObjectCommandBars, wdOrganizerObjectProjectItems, or wdOrganizerObjectStyles.
See Also
OrganizerCopy method, OrganizerRename method.
Example
This example deletes the toolbar named "Custom 1" from the Normal template.
For Each cb In CommandBars
If cb.Name = "Custom 1" Then
Application.OrganizerDelete Source:=NormalTemplate.Name, _
Name:="Custom 1", Object:=wdOrganizerObjectCommandBars
End If
Next cb
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.
For Each entry In ActiveDocument.AttachedTemplate.AutoTextEntries
response = MsgBox("Do you want to delete the " & entry.Name & _
" AutoText entry?", vbYesNoCancel)
If response = vbYes Then
Application.OrganizerDelete Source:=ActiveDocument.AttachedTemplate.Name, _
Name:=entry.Name, Object:=wdOrganizerObjectAutoText
ElseIf response = vbCancel Then
Exit For
End If
Next entry