Custom FaceId Menubar

Excelnewbie001

Board Regular
Joined
Jan 25, 2017
Messages
79
Trying to change the FaceId -this is my current Menu on the exit with a customized faceID -the ID in red I want to change to a bmp picture

Code:
Private Sub Menu1_Lb_Click()
    sPopMenuOpt = ""
    PopMenu1
    MenuBar_Fr_Reset
    Select Case sPopMenuOpt
    Case ""
        Exit Sub
   
        ExitApp_Bt_Click
    End Select
    ThisWorkbook.Save
    'Application.IgnoreRemoteRequests = True
    Application.Quit
End Sub

Private Sub PopMenu1()
    Dim PopMenuBar As Office.CommandBar
    On Error Resume Next: Application.CommandBars("PopMenuBar").Delete: On Error GoTo 0
    Set PopMenuBar = Application.CommandBars.Add(Name:="PopMenuBar", Position:=msoBarPopup, Temporary:=True)
    With PopMenuBar
      

        With .Controls.Add(Type:=msoControlButton)
            .BeginGroup = True
            .Caption = "Exit App"
            .Parameter = "Command106"
            .Tag = "PopMenuTag"
            [COLOR=#ff0000].FaceId = 351[/COLOR]
            End With
         
        Set vClassPopMenuEv = New ClassPopMenuEv
        .ShowPopup

    End With
    Application.CommandBars("PopMenuBar").Delete
    Set PopMenuBar = Nothing
    Set vClassPopMenuEv = Nothing

End Sub


I tried this code https://www.mrexcel.com/forum/excel-questions/20661-customized-faceid.html


to change it but I am getting syntax error on line in red. Can someone please help thank you

Code:
Sheet8.Shapes("Pic1").Copy
.PasteFace


[COLOR=#ff0000]If CopyPictureFromFile shtCustomIcons,ThisWorkbook.Path & "Exit.bmp") Then[/COLOR]
.PasteFace
End If

 Function CopyPictureFromFile(TargetWS As Worksheet, SourceFile As String) As Boolean
' inserts a picture from SourceFile into TargetWS
' copies the picture to the clipboard
' deletes the inserted picture
' returns TRUE if a picture is copied to the clipboard
' the picture can be pasted from the clipboard e.g. to a custom commbarbutton
Dim p As Object
CopyPictureFromFile = False
If TargetWS Is Nothing Then Exit Function
If Len(Dir(SourceFile)) = 0 Then Exit Function
On Error GoTo NoPicture
Set p = TargetWS.Pictures.Insert(SourceFile)
p.CopyPicture xlScreen, xlPicture
p.Delete
Set p = Nothing
On Error GoTo 0
CopyPictureFromFile = True
Exit Function
NoPicture:
End Function
 
Last edited:

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
It looks like you're missing the left bracket and a backslash...

Code:
If CopyPictureFromFile[COLOR=#ff0000]([/COLOR]shtCustomIcons, ThisWorkbook.Path & "[COLOR=#ff0000]\[/COLOR]Exit.bmp") Then

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,214,858
Messages
6,121,960
Members
449,057
Latest member
FreeCricketId

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