Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How do I create a custom image for a toolbar?

The toolbar is being generated upon loading of the excel add-in via the
following code:

Set cmdRW = CommandBars.Add(Name:="DT")


With cmdRW

With .Controls.Add(Type:=msoControlButton)
.TooltipText = "New Sheet"
.OnAction = "Sheet"
.FaceId = 98

I know how to design a new button image when creating a toolbar
manually, but how do I do so when creating the toolbar programtically?

Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How do I create a custom image for a toolbar?

I found the following code, however the image is not displaying in the
toolbar, just a blank space...any help would be greatly appreciated!

THanks


Sub AddPictureToButton()

Dim oShape As Shape

'Place the graphic in the document
Set oShape = ActiveDocument.Shapes.AddPicture(FileName:= _
"PathAndNameOfPicture.gif")

oShape.Select

'Copy graphic
Selection.CopyAsPicture

'Delete from document
Selection.Delete

'Copy the graphic to the first button on your toolbar
'Replace the name of the commandbar with your own
CommandBars("TemplateCommandbar").Controls(1).Past eFace

Set oShape = Nothing

End Sub

---------------------------------------------------------------------------------------------------------

wrote:
The toolbar is being generated upon loading of the excel add-in via the
following code:

Set cmdRW = CommandBars.Add(Name:="DT")


With cmdRW

With .Controls.Add(Type:=msoControlButton)
.TooltipText = "New Sheet"
.OnAction = "Sheet"
.FaceId = 98

I know how to design a new button image when creating a toolbar
manually, but how do I do so when creating the toolbar programtically?

Thanks!


  #3   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default How do I create a custom image for a toolbar?

Instead of
.FaceId = 98

Put...
.Picture = LoadPicture("C:\My picture location")

Note that only certain file types can be used (I don't remember off hand
which ones don't work).

JNW

" wrote:

The toolbar is being generated upon loading of the excel add-in via the
following code:

Set cmdRW = CommandBars.Add(Name:="DT")


With cmdRW

With .Controls.Add(Type:=msoControlButton)
.TooltipText = "New Sheet"
.OnAction = "Sheet"
.FaceId = 98

I know how to design a new button image when creating a toolbar
manually, but how do I do so when creating the toolbar programtically?

Thanks!


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
Toolbar Button Image Question [email protected] Excel Worksheet Functions 1 August 30th 06 09:13 PM
How to increase size of image in button (msocontrolbutton) of custom toolbar of Excel padam Excel Discussion (Misc queries) 0 August 11th 06 07:18 PM
Load image from directory for custom toolbar of Excel 2000 Padam Excel Worksheet Functions 0 August 5th 06 06:33 PM
custom toolbar buttons are saved where? Excel loads twice bymistake and all my custom toolbar buttons get gone!!! Kevin Waite Excel Programming 2 March 3rd 04 03:31 PM
saving toolbar buttons on custom toolbar Paul James Excel Programming 12 August 6th 03 08:28 AM


All times are GMT +1. The time now is 06:50 AM.

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

About Us

"It's about Microsoft Excel"