Info

Eüit

Private Sub Workbook_AddinInstall() Dim cmdControl As CommandBarButton

On Error Resume Next

Set cmdControl = Application.CommandBars(1).Controls("File"). _

Controls(CONTROLNAME) If cmdControl Is Nothing Then

Set cmdControl = Application.CommandBars(1).Controls("File")._ Controls.Add(Type:=msoControlButton, _ Before:=Application.CommandBars(1).Controls("File"). _ Controls("Save").Index)

With cmdControl

.Caption = CONTROLNAME .FaceId = 67

.Style = msoButtonIconAndCaption

.DescriptionText = "Close and delete the current workbook" .OnAction = "CloseAndKill" End With

Set cmdControl = Nothing End If

On Error GoTo 0 End Sub

Private Sub Workbook_AddinUninstall() On Error Resume Next

Application.CommandBars(1).Controls("File").Controls(CONTROLNAME).Delete End Sub

0 0

Post a comment