Excel FaceID - individual icons

Formula11

Active Member
Joined
Mar 1, 2005
Messages
468
Office Version
  1. 365
Platform
  1. Windows
Hi, is there anywhere these individual icons are available.

VBA Ribbon - Face Ids 2003
For the latest Office version though.

I was planning on inserting some of the images in a VBA userform.
 
One other thing I've learnt is that transparency persists if you use a Label control (with the backstyle settings adjusted accordingly) versus an image control.
That's nice to know, thanks.
 
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I tried the ImageMso method with earlier orisons of Excel and got an error.
Was there another similar way with earlier versions of Excel.
 
Upvote 0
ImageMsos only exist in editions with ribbons. What version are you using, and what was the error message/number?
 
Upvote 0
Hi, I can't remember the version or the error message, it may have been before the ribbon.
Is there a way to create an image with coding, rather than uploading an image.

The images will be simple, similar to below.

1661653067136.png
 
Upvote 0
Here is a small code I wrote sometime ago that pastes commandbar controls faceIds into userform labels and which you may find of interest . It retrieves the faceids from the control Picture Property instead of the GetImageMso Method.

FaceIds.xlsm

Unlike the more sophisticated GetImageMso Method, the control Picture Property doesn' allow for choosing the size of the image.

vvvvSans titre.png
 
Upvote 0
Thanks Jaafar, this is really good and may work for my purpose.
The code is harder to understand as it uses a Class Module, I presume a Label is used.
Will look into further in the next few days.
 
Upvote 0
Wow, @Jaafar Tribak , this is awesome. Thank you for this. It took me a moment to realise what kind of control it was I was looking at! You're inspired me to go back and rethink how to come up with some new(ish) controls!

And I had completely forgotten that there was that entire set of shapes in the FaceID set - they're easy to miss. I have an ongoing project when I get bored and am on the phone on call-waiting to sit there are work out some kind of categorisation for FaceIds and ImageMSOs... it's slow-going... but your tool could speed things up!

@Formula11 - here are a bunch (though likely not all) of the Shapes in the FaceId set I've managed to categorise to date - see link. When you click on them, you will get the FaceID number to be used in the VBA code. Just for ease of viewing, I had removed all borders, and grey backgrounds but they will pretty much appear as you see them here (though slightly smaller). Other than that, you can peruse the collection with Jaafar's very useful tool. Don't be put off by the class module - that's there as part of Jaafar's FaceID viewing tool. There really isn't anything you need to do besides work out which numbers you want. Once you've done that, and you let me/us know what you plan to do with the images (use them in menus? in a ribbon? etc), it should be pretty straight forward find some code that will help you accomplish your task (... I say somewhat optimistically, and naïvely....)


1661699480346.png
 
Upvote 0
Jaafar -

Interesting. Why did you use the DataObject in the class module? The control image was put into the clipboard using CopyFace after the code finished with the DataObject. And as we know, DataObject was broken in Windows 8 for most users. Whatever text is put into the clipboard, the clipboard only receives what looks like "??", but each "?" is actually the unicode character number 65535 (or hex FFFF).
 
Upvote 0
So the code works perfectly for me, and on occasion (as is the case with FaceIDs), one or two of them won't copy. I got to thinking - if the image is already being stored already in the Label control as stdPicture, wouldn't it be more reliable than CopyFace to extract the image from that and put it on the clipboard... turns out, not really. For some reason, I've yet to get to the bottom of, the transparency colour(?) is missing an now is replaced with black.


1661711187825.png


Here is the code I tried, in case something jumps out at someone. I feel like I'm missing a step somewhere... like using the stdPicture handle is 'cheating' somehow, and that I really ought to get it's proper bitmap handle...
VBA Code:
   Option Explicit
    
    Private Declare PtrSafe Function OpenClipboard Lib "user32" (ByVal hwnd As LongPtr) As Long
    Private Declare PtrSafe Function EmptyClipboard Lib "user32" () As LongPtr
    Private Declare PtrSafe Function SetClipboardData Lib "user32" (ByVal wFormat As Long, ByVal hMem As LongPtr) As LongPtr
    Private Declare PtrSafe Function CloseClipboard Lib "user32" () As LongPtr
    Private Declare PtrSafe Function DeleteObject Lib "gdi32" (ByVal hObject As LongPtr) As Long
                
    Public WithEvents LblEvents         As MSForms.Label
    Private Const CF_BITMAP             As Long = &H2
    
    Private Sub LblEvents_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
        On Error Resume Next
        Cancel = True
            
        Dim hImage As LongPtr
        OpenClipboard 0
        EmptyClipboard
        hImage = SetClipboardData(CF_BITMAP, LblEvents.Picture.handle)
        CloseClipboard
        
        DeleteObject hImage
        
    End Sub
 
Upvote 0
Dan_W, I just wanted to place items on a userform, when an item is clicked, it runs a macro, similar to other forms. But this one would have a FaceID. The reason for a picture is that it's much easier to guess what it means compared to text, and is a lot smaller.

From what I can gather the FaceID has to be on a Label, but I could be wrong.

Jaafar, I wanted to ask regarding the image, is it stored in the Excel file or on one of the standard Windows folders. So if the file is sent to others, does this cause an issue.
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,201
Members
453,022
Latest member
RobertV1609

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top