FaceID Action and Icon for standard controls

HarryS

Board Regular
Joined
May 2, 2008
Messages
212
Help, F1...F1..F1, I am trying to set a form with labels as a menu.
It has some advantages in, popup - hide , resizing - font size, multi excel versions, Read from sheet so the user can control, all control tips can show, fit full or selected parts of menu

The problems remaining being

From adding a commandbutton as in
' .Controls.Add(Type:=msoControlButton, ID:=Fid)

with the required style we get a button which has the Icon and its action is the action of the the faceid
23 is open etc..
To use this as an action on a form label is part of my current challenge
how can we obtain the onaction string from the faceid number to use as a run command ??
as something like in
run DoFaceIdAction(23)
would hopefully run the open command.
AND an old question on the same lines
How to simply get faceid(xx) as the picture on something like
userform1.label1.picture
without ... putting FaceId on a command button...copyface to get it to clipboard ..saving clipboard to a file as a bitmap... loading the label.picture from the file
Thanks in anticipation for any help... I have just about worn out the F1 key:ROFLMAO:
Harry S
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
some more information

The VBE with form ,label ,properties, picture, and then paste or Ctrl V will put the image of the clipboard onto the form label as a picture..

The cut copy paste from various menu are different but Ctrl C X V etc work OK by sendKey

the code below // manily using the paste picture from Stephen Bullen //
will put faceIDs and captions onto a form control... from which the form control's events can run what ever is needed. BUT it seems a lot of round obout effort when the VBE must have the necessary API for a direct paste of the clipboard constants
Rich (BB code):
Option Explicit
Option Compare Text
Public ImgFileName$, FidCap$
Sub Testit()
    ' needs userform1  with labels  1  2  3  etc
    FaceLabel 4, UserForm1.Label1  ' 4 is print
    FaceLabel 99, UserForm1.Label2, "Letter T"
    FaceLabel 22, UserForm1.Label3  ' 22 is paste
    UserForm1.Show
End Sub
Sub FaceLabel(fID%, LabP As MSForms.Label, Optional SentCap$ = "")
     Dim NewCtrL
    ' where ever for temp file
    ImgFileName = ActiveWorkbook.Path & "/TempIcon.bmp"
    With CommandBars.Add
        On Error Resume Next  ' try as standard icon and caption as in Cut  Open etc
        Set NewCtrL = .Controls.Add(Type:=msoControlButton, ID:=fID)
        If Err.Number <> 0 Then  ' is not a standard button so use SentCap
            Set NewCtrL = .Controls.Add(Type:=msoControlButton)
            NewCtrL.Caption = SentCap
        End If
        With NewCtrL
            .Style = 3    ' msoButtonIconAndCaption
            .FaceId = fID
            FidCap = .Caption
            .CopyFace
        End With
        .Delete  ' command bar
    End With
    ' needs  Stephen Bullen 's paste picture module for the  next line
    SavePicture PastePicture(xlBitmap), ImgFileName
    With LabP
        .Picture = LoadPicture(ImgFileName)
        .Caption = FidCap
        .PicturePosition = 1
        .BorderStyle = 1
        .Font.Size = 14
        .Object.WordWrap = False ' now here is a funny way to get at wordwrap
        .AutoSize = True
    End With
End Sub
' there has to be a better way... But this may help someone .. as it is .. or fixed by someone who knows how to avoid the save load file bits
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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