M
Madiya
Hi all,
I face a small problem.
Following code works fine.
Sub ADD_COMMAND()
CommandBars("Cell").Reset
With Application.CommandBars("Cell").Controls
With .Add
.Caption = "OGP"
.OnAction = ThisWorkbook.Name & "OGP"
.Tag = OGPTAG
.BeginGroup = True
' .Temporary = True <<<<<< THIS LINE NOT WORKING
SO COMMENTED OUT
End With
End With
CommandBars("cell").Controls("OGP").FaceId = 44
End Sub
However, If I place the same code in worksheet activate event it does
not work.
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.Name <> "ALVXXL01" Then
Exit Sub
End If
CommandBars("Cell").Reset <<<<<< error out
here .>>>>>>
With Application.CommandBars("Cell").Controls
With .Add
.Caption = "OGP"
.OnAction = ThisWorkbook.Name & "OGP"
.Tag = OGPTAG
.BeginGroup = True
' .Temporary = True
End With
End With
CommandBars("Cell").Controls("OGP").FaceId = 44
End Sub
Can somebody point out the mistake I am making please.
Regards,
Madiya
I face a small problem.
Following code works fine.
Sub ADD_COMMAND()
CommandBars("Cell").Reset
With Application.CommandBars("Cell").Controls
With .Add
.Caption = "OGP"
.OnAction = ThisWorkbook.Name & "OGP"
.Tag = OGPTAG
.BeginGroup = True
' .Temporary = True <<<<<< THIS LINE NOT WORKING
SO COMMENTED OUT
End With
End With
CommandBars("cell").Controls("OGP").FaceId = 44
End Sub
However, If I place the same code in worksheet activate event it does
not work.
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Sh.Name <> "ALVXXL01" Then
Exit Sub
End If
CommandBars("Cell").Reset <<<<<< error out
here .>>>>>>
With Application.CommandBars("Cell").Controls
With .Add
.Caption = "OGP"
.OnAction = ThisWorkbook.Name & "OGP"
.Tag = OGPTAG
.BeginGroup = True
' .Temporary = True
End With
End With
CommandBars("Cell").Controls("OGP").FaceId = 44
End Sub
Can somebody point out the mistake I am making please.
Regards,
Madiya