Events (Visual Basic Add-In Model)
Click event
Occurs when the OnAction property of a corresponding command bar control is set.
Syntax
Subobject_Click (ByVal ctrl As Object, ByRef handled As Boolean, ByRef canceldefault As Boolean)
The Click event syntax has these named arguments:
Part | Description |
---|---|
ctrl | Required; Object. Specifies the object that is the source of the Click event. |
handled | Required; Boolean. If True, other add-ins should handle the event. If False, the action of the command bar item has not been handled. |
canceldefault | Required; Boolean. If True, default behavior is performed unless canceled by a downstream add-in. If False, default behavior is not performed unless restored by a downstream add-in. |
Remarks
The Click event is specific to the CommandBarEvents object. Use a variable declared by using the WithEvents keyword to receive the Click event for a CommandBar control. This variable should be set to the return value of the CommandBarEvents property of the Events object.
The CommandBarEvents property takes the CommandBar control as an argument. When the CommandBar control is clicked (for the variable you declared by using the WithEvents keyword), the code is executed.
ItemAdded event
Occurs after a reference is added.
Syntax
Subobject_ItemAdded (ByVal item As Reference)
The required item argument specifies the item that was added.
Remarks
The ItemAdded event occurs when a Reference is added to the References collection.
ItemRemoved event
Occurs after a Reference is removed from a project.
Syntax
Subobject_ItemRemoved (ByVal item As Reference)
The required item argument specifies the Reference that was removed.
See also
- ReferencesEvents object
- Events (Microsoft Forms)
- Events (Visual Basic for Applications)
- Visual Basic Add-in Model reference
- Visual Basic language reference
- Office client development reference
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 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기