PasteFace-Problem

T

Tom

Hi

I created an entry in the commandbar with a customized icon. The code is the
following:

Sub Test()
Dim cbrMenuCtrl As CommandBarButton

Worksheets("Init").Shapes(1).Copy

Set cbrMenuCtrl = Application.CommandBars("Tools").Controls.Add
With cbrMenuCtrl
.Caption = "Hello"
.OnAction = ThisWorkbook.Name & "!blabla"
.PasteFace
End With

Application.CutCopyMode = False

End Sub


The problem is that the icon remains in the Excel memory. When I enter the
paste command the icon will be pasted?!? How to free the memory?

Tom
 
T

Tom Ogilvy

Sub Test()
Dim cbrMenuCtrl As CommandBarButton

Worksheets("Init").Shapes(1).Copy

Set cbrMenuCtrl = Application.CommandBars("Tools").Controls.Add
With cbrMenuCtrl
.Caption = "Hello"
.OnAction = ThisWorkbook.Name & "!blabla"
.PasteFace
End With
ActiveCell.Copy
Application.CutCopyMode = False

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top