Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Changing button appearance on custom toolbar.

Dear Excel folks,

I have the following code that adds a custom toolbarand adds four identical
buttons to the toolbar. It works just fine except I want to change the
appearances of three of the buttons so that they aren't just all smiley
faces. I don't need to edit the button images as bitmaps or anything fancy,
just one of the standard button images is fine. Also, if possible, I would
like to add whatever those little pop-up screen tips are called when you have
the mouse pointer on a button.


Sub AddButtonTest2()
'
' AddButtonTest2 Macro
' Macro recorded 9/24/2004 by Knight ITC
'
' File name = EquGen.xls
' Toolbar name = EquationCopies
' Toolbar starts without any buttons
' 1st Macro name = CopytoEquationGenerator
' 2nd Macro name = CopytoEquationGeneratorTarget
' 3rd Macro name = CopytoErrorAnalysis
' 4th Macro name = CopytoErrorAnalysis
Dim Cmd As CommandBarButton
Application.CommandBars.Add(Name:="EquationCopies" ).Visible = True
Set Cmd = Application.CommandBars("EquationCopies").Controls .Add( _
Type:=msoControlButton, _
ID:=2950, Befo=1)
Cmd.Caption = "CopyTo"
Cmd.OnAction = "'EquGen.xls'!CopyToEquationGenerator"
Set Cmd = Application.CommandBars("EquationCopies").Controls .Add( _
Type:=msoControlButton, _
ID:=2950, Befo=2)
Cmd.Caption = "CopyTo"
Cmd.OnAction = "'EquGen.xls'!CopyToEquationGeneratorTarget"
Set Cmd = Application.CommandBars("EquationCopies").Controls .Add( _
Type:=msoControlButton, _
ID:=2950, Befo=3)
Cmd.Caption = "CopyTo"
Cmd.OnAction = "'EquGen.xls'!CopyToErrorAnalysis"
Set Cmd = Application.CommandBars("EquationCopies").Controls .Add( _
Type:=msoControlButton, _
ID:=2950, Befo=4)
Cmd.Caption = "CopyTo"
Cmd.OnAction = "'EquGen.xls'!CopyToErrorAnalysisTarget"
End Sub

Many thanks in advance!
amescha
Charles Ames
University of Oregon
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Changing button appearance on custom toolbar.

set the faceid property of the button for the image

set the tooltiptext for the popup tip

John Walkenbach has a utility to show you the faceid's
http://j-walk.com/ss/excel/tips/tip67.htm
Identifying FaceID Values for CommandBar Images

--
Regards,
Tom Ogilvy


"amescha" wrote in message
...
Dear Excel folks,

I have the following code that adds a custom toolbarand adds four

identical
buttons to the toolbar. It works just fine except I want to change the
appearances of three of the buttons so that they aren't just all smiley
faces. I don't need to edit the button images as bitmaps or anything

fancy,
just one of the standard button images is fine. Also, if possible, I would
like to add whatever those little pop-up screen tips are called when you

have
the mouse pointer on a button.


Sub AddButtonTest2()
'
' AddButtonTest2 Macro
' Macro recorded 9/24/2004 by Knight ITC
'
' File name = EquGen.xls
' Toolbar name = EquationCopies
' Toolbar starts without any buttons
' 1st Macro name = CopytoEquationGenerator
' 2nd Macro name = CopytoEquationGeneratorTarget
' 3rd Macro name = CopytoErrorAnalysis
' 4th Macro name = CopytoErrorAnalysis
Dim Cmd As CommandBarButton
Application.CommandBars.Add(Name:="EquationCopies" ).Visible = True
Set Cmd = Application.CommandBars("EquationCopies").Controls .Add( _
Type:=msoControlButton, _
ID:=2950, Befo=1)
Cmd.Caption = "CopyTo"
Cmd.OnAction = "'EquGen.xls'!CopyToEquationGenerator"
Set Cmd = Application.CommandBars("EquationCopies").Controls .Add( _
Type:=msoControlButton, _
ID:=2950, Befo=2)
Cmd.Caption = "CopyTo"
Cmd.OnAction = "'EquGen.xls'!CopyToEquationGeneratorTarget"
Set Cmd = Application.CommandBars("EquationCopies").Controls .Add( _
Type:=msoControlButton, _
ID:=2950, Befo=3)
Cmd.Caption = "CopyTo"
Cmd.OnAction = "'EquGen.xls'!CopyToErrorAnalysis"
Set Cmd = Application.CommandBars("EquationCopies").Controls .Add( _
Type:=msoControlButton, _
ID:=2950, Befo=4)
Cmd.Caption = "CopyTo"
Cmd.OnAction = "'EquGen.xls'!CopyToErrorAnalysisTarget"
End Sub

Many thanks in advance!
amescha
Charles Ames
University of Oregon



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Changing button appearance on custom toolbar.

Tom,

Thanks again! The J-Walk add-in worked like a charm. The other macro at that
site crashed about 2/3 of the way through unfortunately. Gave a -Big number
run-time error. When I went back to Excel spreadheet I had another error
saying "Out of memory". Oh well.
BTW I solved the mouse pointer question:
CmdCaption = "Whatever you want it to say"


amescha
Charles Ames
University of Oregon


"Tom Ogilvy" wrote:

set the faceid property of the button for the image

set the tooltiptext for the popup tip

John Walkenbach has a utility to show you the faceid's
http://j-walk.com/ss/excel/tips/tip67.htm
Identifying FaceID Values for CommandBar Images

--
Regards,
Tom Ogilvy


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
Custom toolbar button icons leaftye - ExcelForums.com Excel Discussion (Misc queries) 2 July 7th 05 06:09 PM
Delete a custom button by holding down the ALT key and dragging the button off the toolbar Stephen[_8_] Excel Programming 0 April 4th 04 02:22 PM
Can't delete custom button and toolbar Ron de Bruin Excel Programming 1 March 1st 04 09:46 PM
Cannot Get Caption to show on custom toolbar button Rob Bovey Excel Programming 1 August 1st 03 02:38 AM
custom toolbar button that visually toggles in and out Paul Simon[_2_] Excel Programming 1 July 26th 03 10:35 PM


All times are GMT +1. The time now is 05:45 PM.

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"