ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   icons for custom menu choices (https://www.excelbanter.com/excel-programming/272120-re-icons-custom-menu-choices.html)

Tom Ogilvy

icons for custom menu choices
 
Get the icon in the clipboard, then use pasteface on the button. (doing
this with code)

Regards,
Tom Ogilvy

John A Grandy wrote in message
...
how to add icons to custom choices added to the cell menu (the right-click
menu) such as the ones displayed for Cut Copy Paste ... ?





John A Grandy

icons for custom menu choices
 
Thanks Tom. But how to programatically load an icon from a .ico file into
the clipboad?


"Tom Ogilvy" wrote in message
...
Get the icon in the clipboard, then use pasteface on the button. (doing
this with code)

Regards,
Tom Ogilvy

John A Grandy wrote in message
...
how to add icons to custom choices added to the cell menu (the

right-click
menu) such as the ones displayed for Cut Copy Paste ... ?







Tom Ogilvy

icons for custom menu choices
 
There may be a better way, but I got this to work. You might want to play a
bit with the sizing of the image in the image control before you do the copy
since it is copying the whole image control - not sure how this will affect
background color and so forth.

Sub PasteAFace()
Dim cb_btn As CommandBarButton
Dim ictrl As MSForms.Image
Dim oleObj As OLEObject
Set oleObj = ActiveSheet.OLEObjects.Add( _
ClassType:="Forms.Image.1", _
Link:=False, _
DisplayAsIcon:=False, _
Left:=193.5, Top:=185.25, _
Width:=66, Height:=63)
Set ictrl = oleObj.Object
With ictrl
.PictureSizeMode = fmPictureSizeModeZoom
.Picture = LoadPicture("C:\windows\winupd.ico")
End With
With oleObj
.CopyPicture Appearance:=xlScreen, Format:=xlPicture
.Delete
End With

Set cb_btn = CommandBars("Custom 3").Controls(1)
cb_btn.PasteFace
End Sub

--
Regards,
Tom Ogilvy





John A Grandy wrote in message
...
Thanks Tom. But how to programatically load an icon from a .ico file into
the clipboad?


"Tom Ogilvy" wrote in message
...
Get the icon in the clipboard, then use pasteface on the button. (doing
this with code)

Regards,
Tom Ogilvy

John A Grandy wrote in message
...
how to add icons to custom choices added to the cell menu (the

right-click
menu) such as the ones displayed for Cut Copy Paste ... ?










All times are GMT +1. The time now is 08:24 AM.

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