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
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:
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: