M
Mike
I am trying to make a new button with my own custom icon, but am having
trouble pasting it in: Private Sub Workbook_Open()
I want to make this into an .xla add-in, but am having trouble with my
custom icon.
Based on other posts, I have tried the following 2 ideas, but they don't
work. Any help is appreciated:
APPROACH #1 - Tries to set FACEID to icon in cell I1 (does not work)
With Application.CommandBars("Standard")
With .Controls.Add(Temporary:=True)
.BeginGroup = True
.Style = msoButtonIcon
' Icon is put in cell I1
.FaceId = ThisWorkbook.Worksheets("Sheet1").Range("I1").Value
.Caption = "my functionality"
.TooltipText = "my functionality"
.OnAction = "myFunctionality"
Endwith
Endwith
APRROACH #2 - uses PASTEFACE (also does not work)
Dim i As Integer
With Application.CommandBars("Standard")
With .Controls.Add(Temporary:=True)
.BeginGroup = True
.Style = msoButtonIcon
' Icon is put in cell I1
.FaceId = ThisWorkbook.Worksheets("Sheet1").Range("I1").Value
.Caption = "my functionality"
.TooltipText = "my functionality"
.OnAction = "myFunctionality"
i = .ID
Endwith
ThisWorkbook.Worksheets("Sheet1").Shapes(Range("I1").Value).CopyPicture
.Controls.Item(i).PasteFace
Endwith
Once again, thanks for any help!
trouble pasting it in: Private Sub Workbook_Open()
I want to make this into an .xla add-in, but am having trouble with my
custom icon.
Based on other posts, I have tried the following 2 ideas, but they don't
work. Any help is appreciated:
APPROACH #1 - Tries to set FACEID to icon in cell I1 (does not work)
With Application.CommandBars("Standard")
With .Controls.Add(Temporary:=True)
.BeginGroup = True
.Style = msoButtonIcon
' Icon is put in cell I1
.FaceId = ThisWorkbook.Worksheets("Sheet1").Range("I1").Value
.Caption = "my functionality"
.TooltipText = "my functionality"
.OnAction = "myFunctionality"
Endwith
Endwith
APRROACH #2 - uses PASTEFACE (also does not work)
Dim i As Integer
With Application.CommandBars("Standard")
With .Controls.Add(Temporary:=True)
.BeginGroup = True
.Style = msoButtonIcon
' Icon is put in cell I1
.FaceId = ThisWorkbook.Worksheets("Sheet1").Range("I1").Value
.Caption = "my functionality"
.TooltipText = "my functionality"
.OnAction = "myFunctionality"
i = .ID
Endwith
ThisWorkbook.Worksheets("Sheet1").Shapes(Range("I1").Value).CopyPicture
.Controls.Item(i).PasteFace
Endwith
Once again, thanks for any help!