Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default New custom FaceID for automated button

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").Valu e
.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").Valu e
.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!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default New custom FaceID for automated button

You need to paste the image into a worksheet and use

cbTable.Shapes(shapename).Copy*Picture
cbCtl.PasteFace

where cbTable is the codename of the sheet containing the picture, shapename
is the name of the shape, such as 'Picture 30', and cbCtl is an object
variable for the control being added.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mike" wrote in message
...
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").Valu e
.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").Valu e
.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!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default New custom FaceID for automated button

Thanks a lot! I realized after a few tries that the shapename has to be in
quotes. It worked out!

"Bob Phillips" wrote:

You need to paste the image into a worksheet and use

cbTable.Shapes(shapename).CopyÂ*Picture
cbCtl.PasteFace

where cbTable is the codename of the sheet containing the picture, shapename
is the name of the shape, such as 'Picture 30', and cbCtl is an object
variable for the control being added.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mike" wrote in message
...
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").Valu e
.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").Valu e
.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!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default New custom FaceID for automated button

Yeah, sorry I should have made that clear.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mike" wrote in message
...
Thanks a lot! I realized after a few tries that the shapename has to be in
quotes. It worked out!

"Bob Phillips" wrote:

You need to paste the image into a worksheet and use

cbTable.Shapes(shapename).Copy*Picture
cbCtl.PasteFace

where cbTable is the codename of the sheet containing the picture,

shapename
is the name of the shape, such as 'Picture 30', and cbCtl is an object
variable for the control being added.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mike" wrote in message
...
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").Valu e
.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").Valu e
.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!






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2003 - 2007 custom macro and custom button restore. Scott Sornberger Excel Discussion (Misc queries) 11 May 23rd 08 02:41 PM
Automated sort button Bwells Excel Discussion (Misc queries) 4 September 20th 07 03:22 PM
Help with faceid and button images filo666 Excel Programming 2 May 9th 05 11:32 PM
custom Header-Automated juan Excel Programming 4 April 16th 04 05:28 PM
Button Faceid David Fixemer Excel Programming 2 February 21st 04 12:18 AM


All times are GMT +1. The time now is 01:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"