PasteFace issue

S

Sige

Hi There,

I would like to set a "picture" on a Subitem ... but I bug on:
"PasteFace"!
===> Method PasteFace of object "CommandBarButton" failed!
Using XL97SR2 - I cannot use PasteFace method on Subitems?

Any Ideas?
Sige


Sub AddShortCuts()
Dim cb As CommandBar, Item As CommandBarControl, Subitem As Object

ThisWorkbook.Sheets(1).Pictures("Picture 8").Copy

Set cb = Application.CommandBars("Cell")
'item
Set Item = cb.Controls.Add(Type:=msoControlPopup,temporary:=True)
With Item
.BeginGroup = True
.Caption = "Sige View..."
End With

'sub-items

Set Subitem = Item.Controls.Add(Type:=msoControlButton,
temporary:=True)
With Subitem
.BeginGroup = False
.Caption = "Clean"
.OnAction = "Trim"
.PasteFace
End With
End Sub
 
J

Jim Rech

I tried your code in Excel 97 SR-2(n) and it ran fine. I used an image I
copied from another toolbutton so I know it's okay on a toolbutton. Does
you image paste okay manually?

--
Jim

| Hi There,
|
| I would like to set a "picture" on a Subitem ... but I bug on:
| "PasteFace"!
| ===> Method PasteFace of object "CommandBarButton" failed!
| Using XL97SR2 - I cannot use PasteFace method on Subitems?
|
| Any Ideas?
| Sige
|
|
| Sub AddShortCuts()
| Dim cb As CommandBar, Item As CommandBarControl, Subitem As Object
|
| ThisWorkbook.Sheets(1).Pictures("Picture 8").Copy
|
| Set cb = Application.CommandBars("Cell")
| 'item
| Set Item = cb.Controls.Add(Type:=msoControlPopup,temporary:=True)
| With Item
| .BeginGroup = True
| .Caption = "Sige View..."
| End With
|
| 'sub-items
|
| Set Subitem = Item.Controls.Add(Type:=msoControlButton,
| temporary:=True)
| With Subitem
| .BeginGroup = False
| .Caption = "Clean"
| .OnAction = "Trim"
| .PasteFace
| End With
| End Sub
|
 
S

Sige

Yes Jim ...it was no issue at all....
I inserted a picture by Insert>Picture>FromFile...
But no matter what picture I use... my PasteFace returns the error. Not
the faintest idea why.


Sige
 

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