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
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.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기