C
Carroll
Hello,
I have VBA that adds items to my right-click menu upon opening the
spreadsheet, then deletes them upon closing. Unfortunately, I have
ended up with the items being repeated 5 times over. It currently is
not adding any more to this number, but I don't know how to get rid of
the extra items, or how to prevent this from happening in the future.
Any ideas? I think it may have occurred when I was creating a backup
of the current spreadsheet.
Private Sub Workbook_Open()
With Application.CommandBars("Cell").Controls.Add(temporary:=True)
.Caption = "Hide Shapes"
.OnAction = ThisWorkbook.Name & "!HideShapes"
.BeginGroup = True
End With
With Application.CommandBars("Cell").Controls.Add(temporary:=True)
.Caption = "Show Shapes"
.OnAction = ThisWorkbook.Name & "!ShowShapes"
.BeginGroup = True
End With
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Cell").Controls("Hide Shapes").Delete
Application.CommandBars("Cell").Controls("Show Shapes").Delete
End Sub
Thanks,
Carroll Rinehart
I have VBA that adds items to my right-click menu upon opening the
spreadsheet, then deletes them upon closing. Unfortunately, I have
ended up with the items being repeated 5 times over. It currently is
not adding any more to this number, but I don't know how to get rid of
the extra items, or how to prevent this from happening in the future.
Any ideas? I think it may have occurred when I was creating a backup
of the current spreadsheet.
Private Sub Workbook_Open()
With Application.CommandBars("Cell").Controls.Add(temporary:=True)
.Caption = "Hide Shapes"
.OnAction = ThisWorkbook.Name & "!HideShapes"
.BeginGroup = True
End With
With Application.CommandBars("Cell").Controls.Add(temporary:=True)
.Caption = "Show Shapes"
.OnAction = ThisWorkbook.Name & "!ShowShapes"
.BeginGroup = True
End With
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Cell").Controls("Hide Shapes").Delete
Application.CommandBars("Cell").Controls("Show Shapes").Delete
End Sub
Thanks,
Carroll Rinehart