ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   PasteFace issue (https://www.excelbanter.com/excel-programming/342181-pasteface-issue.html)

SIGE

PasteFace issue
 
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:=T rue)
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


Jim Rech

PasteFace issue
 
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

"Sige" wrote in message
oups.com...
| 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:=T rue)
| 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
|



SIGE

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


Sige



All times are GMT +1. The time now is 11:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com