PDA

View Full Version : Face IDs and Buttons



Atravis
08-19-2010, 03:40 AM
I found this code online for faceids;

Sub MakeAllFaceIDs()
'make 14 toolbars, with 300 faces each
'note that maxid is greater than last valid ID, so error will
'occur when first invalid ID is used
Const maxId = 3900
On Error GoTo realMax
For bars = 0 To 13
firstId = bars * 300
lastId = firstId + 299
Set tb = CommandBars.Add
For I = firstId To lastId
Set btn = tb.Controls.Add
btn.FaceId = I
btn.TooltipText = "Faceid = " & I
Next
tb.Name = ("Faces " & CStr(firstId) & " to " & CStr(lastId))
tb.Width = 591
tb.Visible = True
Next
'Delete the button that caused the error and set toolbar name
realMax:
btn.Delete
tb.Name = ("Faces " & CStr(firstId) & " to " & CStr(I - 1))
tb.Width = 591
tb.Visible = True
End Sub

I would ideally like to be able to use one of the images used in the face IDs (in particular number 1550) as the image on a command button but can't seem to find a way of calling the image in a way that allows it to be used like this. Is there anyway of doing this?

Thanks.

Bob Phillips
08-19-2010, 03:55 AM
You just set the FaceId property of your button to that number.

Atravis
08-19-2010, 03:58 AM
I didn't think there was (can't find) a faceID property for a command button. Would you be able to provide a line with this?

Thanks

Bob Phillips
08-19-2010, 04:42 AM
I am referring to buttons that you add to a menu or toolbar in Excel. Are we talking about the same thing?

Atravis
08-19-2010, 05:11 AM
No, i am trying to use it on a standard command button that can be used on a userform. Sorry, maybe i should've been more clear.

Bob Phillips
08-19-2010, 05:42 AM
Then you need to create an image file (gif, jpg) and use the Picture property of the button.

Andy Pope
08-19-2010, 08:42 AM
You can make use of Stephen Bullen's PastePicture code to copy and paste FaceID images.
You also need to create a temporary commandbar and button in order to make use of CopyFace method.