Excel FaceID - individual icons

Formula11

Active Member
Joined
Mar 1, 2005
Messages
433
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.
 
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.
Well this is pretty much what FaceIds were designed for :)
It doesn't have to be on a label, no. It can be placed on any control that has a Picture property - that includes the Label, CommandButton, Checkbox, Option Button, etc - it can also be used in the ImageBox (unsurprisingly), but I would suggest opting for the label control over the Imagebox (it looks better). .
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.
Jon and Jaafar would know better than I would, but for my part, I think it's unlikely that the use of FaceId images would cause any compatibility issues. FaceIDs were the ImageMSOs before the ImageMSOs were a thing. That being the case, like ImageMSOs, FaceIDs are built into Microsoft Office. That said, I think it may be the case the that the range of FaceIDs available on each system will vary from system-to-system depending on precisely what items of the broader MS Office suite you have installed. If this is the case (and I could just just be making this entire thing up!), I think it's only relevant in relation to a handful of extra images and that's only if you happen to have something like Visio or something... Again, if any of this bears any resemblance to reality, I don't think it's likely to be an issue.

And in any event, you can just save the images in the userform/controls when you save and distribute the file. In the code above, we've been loading the images into these controls at runtime, but only because we didn't have a reason to do otherwise. These images (FaceIDs/ImageMSOs) can be saved as BMP image files, at which point you can do whatever you like with them, and there won't be any compatibility issues. With the original ImageMSO code I gave you, for example, you could just adjust it slightly:

VBA Code:
Sub SaveImageMSO()
    Dim NewImage As stdole.StdPicture
    Set NewImage = Application.CommandBars.GetImageMso("PageSetupPageDialog", 32, 32)
    stdole.SavePicture NewImage, "D:\MyNewImageMso.BMP"
End Sub
... for example.

Does that help?
 
Upvote 0

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Thanks. I haven't tested in the older version of Excel, but was expecting to call up the image using a number and not the description such as "PageSetupPageDialog".

If the FaceIDs are built in to the system, then I won't need to save as I infer that it won't be an issue.

This is my attempt but not showing anything.


VBA Code:
Private Sub UserForm_Initialize()
    Dim NewImage As StdPicture
    Set NewImage = Application.CommandBars.FindControl(ID:=268)
    Image_test.Picture = NewImage
End Sub
 
Upvote 0
Thanks. I haven't tested in the older version of Excel, but was expecting to call up the image using a number and not the description such as "PageSetupPageDialog".

If the FaceIDs are built in to the system, then I won't need to save as I infer that it won't be an issue.

This is my attempt but not showing anything.


VBA Code:
Private Sub UserForm_Initialize()
    Dim NewImage As StdPicture
    Set NewImage = Application.CommandBars.FindControl(ID:=268)
    Image_test.Picture = NewImage
End Sub
VBA Code:
Private Sub UserForm_Initialize()
    Dim NewImage As StdPicture
    Set NewImage = Application.CommandBars.FindControl(ID:=21).Picture
    Image_test.Picture = NewImage
End Sub

ID:= 268 doesn't work. This is the case with many other commandbar controls :
Dim oCmbCtrl As CommandBarControl Set oCmbCtrl = Application.CommandBars.FindControl(ID:=268) MsgBox TypeName(oCmbCtrl) '<<== returns Nothing.
.
 
Upvote 0
Hi Jon,
Interesting. Why did you use the DataObject in the class module?
If I remember right, while testing, some of the control images would fail to be copied unless I changed the contents of the clipboard prior to calling CopyFace. What seemd tro work was adding some dummy text. Using the DataObject Clear Method didn't work either.

DataObject was broken in Windows 8 for most users. Whatever text is put into the clipboard, the clipboard only receives what looks like "??"
I wasn't aware of that.

Thanks.
 
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....)


View attachment 72636
Hi Dan,

Just for ease of viewing, I had removed all borders, and grey backgrounds
How did you do that ?

Thanks.
 
Upvote 0
Thanks Jaafar.
I tried with FaceID 21, presumably this shows, but I got an error with my code though. Run time error 13 Type mismatch.
 
Upvote 0
Thanks Jaafar.
I tried with FaceID 21, presumably this shows, but I got an error with my code though. Run time error 13 Type mismatch.
Error on which line ?

Try fully qualifying StdPicture as follows and see if it stops the error:
Dim NewImage As stdole.StdPicture
 
Upvote 0
Thanks, I tried that before as well.
The error is at the line UserForm1.Show.

VBA Code:
Sub test()
    UserForm1.Show
End Sub


VBA Code:
Option Explicit
Private Sub UserForm_Initialize()
    Dim NewImage As stdole.StdPicture
    Set NewImage = Application.CommandBars.FindControl(ID:=21)
    Image_test.Picture = NewImage
End Sub
 
Upvote 0
HI Jaafar

I used Excel's ability to apply transparency to a given colour to get rid of the offwhite/grey background colour(15790320), and then I adjust the Shape.DrawingObject.Border.LineStyle = 0
VBA Code:
Sub OrganiseFaceID()
    Dim X               As Long
    Dim Y               As Long
    Dim FaceIDShape     As Shape
    
    X = 0
    Y = 20
    
    For Each FaceIDShape In Application.ActiveSheet.Shapes
        counter = counter + 1
        X = X + 50
        With FaceIDShape
            .Left = X
            .Top = Y
            .PictureFormat.TransparencyColor = 15790320
            .DrawingObject.Border.LineStyle = 0
        End With
    
        If counter Mod 10 = 0 Then
            X = 0
            Y = Y + 50
        End If
    Next
End Sub

Before
1661770267441.png



After
1661770311199.png
 
Upvote 0
Thanks, I tried that before as well.
The error is at the line UserForm1.Show.

VBA Code:
Sub test()
    UserForm1.Show
End Sub


VBA Code:
Option Explicit
Private Sub UserForm_Initialize()
    Dim NewImage As stdole.StdPicture
    Set NewImage = Application.CommandBars.FindControl(ID:=21)
    Image_test.Picture = NewImage
End Sub
You've missed a part from Jaafar's code - the .Picture part at the end

VBA Code:
    Set NewImage = Application.CommandBars.FindControl(ID:=21).Picture

It only shows the Userform show line as being the error because of your error settings. By default, VBA won't 'break' in a class module (or here, a userform). You can adjust the settings here at the Error Trapping part:
1661770840783.png
 
Upvote 0

Forum statistics

Threads
1,214,626
Messages
6,120,602
Members
448,974
Latest member
ChristineC

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