A
A.Q
Hi all,
I have this code, it works really well if I put it in workbook_open() event.
But I need the commandbar active when user install the add-in file. and
delete it when the add-in is removed
Thanks for your help
Private Sub Workbook_Open()
Dim oCb As CommandBar
Dim oCtl As CommandBarButton
On Error Resume Next
Application.CommandBars("Worksheet Menu Bar").Controls("Import
Text").Delete
On Error GoTo 0
Set oCb = Application.CommandBars("Worksheet Menu Bar")
With oCb
Set oCtl = .Controls.Add( _
Type:=msoControlButton, _
temporary:=True)
oCtl.Caption = "Import Text"
oCtl.Style = msoButtonCaption
oCtl.OnAction = "ImportText"
End With
End Sub
I have this code, it works really well if I put it in workbook_open() event.
But I need the commandbar active when user install the add-in file. and
delete it when the add-in is removed
Thanks for your help
Private Sub Workbook_Open()
Dim oCb As CommandBar
Dim oCtl As CommandBarButton
On Error Resume Next
Application.CommandBars("Worksheet Menu Bar").Controls("Import
Text").Delete
On Error GoTo 0
Set oCb = Application.CommandBars("Worksheet Menu Bar")
With oCb
Set oCtl = .Controls.Add( _
Type:=msoControlButton, _
temporary:=True)
oCtl.Caption = "Import Text"
oCtl.Style = msoButtonCaption
oCtl.OnAction = "ImportText"
End With
End Sub