Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Custom Toolbar

I have added a custome toolbar with the following code. I would like to add
a tooltip to this button. Also, can I have a button with text instead of the
icon?

Dim cb As CommandBar
Set cb = CommandBars.Add
With cb
.Name = "SWAP"
.Position = msoBarTop
End With

Set myBar = CommandBars("SWAP")
Set myControl = myBar.Controls _
.Add(Type:=msoControlButton, _
Temporary:=True)
With myControl
.FaceId = 47
.Width = 75
.OnAction = "ResetValues"
End With
myBar.Visible = True

Many Thanks
--
Robert Hill

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Custom Toolbar

One way:

With Application.CommandBars
On Error Resume Next
.Item("SWAP").Delete
On Error GoTo 0
With .Add( _
Name:="SWAP", _
Position:=msoBarTop, _
MenuBar:=False, _
Temporary:=True)
With .Controls.Add( _
Type:=msoControlButton, _
Id:=1, _
Befo=1, _
Temporary:=True)
'.FaceId = 47
.Width = 75
.Style = msoButtonCaption
.Caption = "Caption"
.TooltipText = "Tooltip Text"
.OnAction = "ResetValues"
End With
.Visible = True
End With
End With

In article ,
Robert wrote:

I have added a custome toolbar with the following code. I would like to add
a tooltip to this button. Also, can I have a button with text instead of the
icon?

Dim cb As CommandBar
Set cb = CommandBars.Add
With cb
.Name = "SWAP"
.Position = msoBarTop
End With

Set myBar = CommandBars("SWAP")
Set myControl = myBar.Controls _
.Add(Type:=msoControlButton, _
Temporary:=True)
With myControl
.FaceId = 47
.Width = 75
.OnAction = "ResetValues"
End With
myBar.Visible = True

Many Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Custom Toolbar

Thanks. That worked great. Is there a way to hide macros so that a user
cannot run them? I am not very good with Excel.
--
Robert Hill



"JE McGimpsey" wrote:

One way:

With Application.CommandBars
On Error Resume Next
.Item("SWAP").Delete
On Error GoTo 0
With .Add( _
Name:="SWAP", _
Position:=msoBarTop, _
MenuBar:=False, _
Temporary:=True)
With .Controls.Add( _
Type:=msoControlButton, _
Id:=1, _
Befo=1, _
Temporary:=True)
'.FaceId = 47
.Width = 75
.Style = msoButtonCaption
.Caption = "Caption"
.TooltipText = "Tooltip Text"
.OnAction = "ResetValues"
End With
.Visible = True
End With
End With

In article ,
Robert wrote:

I have added a custome toolbar with the following code. I would like to add
a tooltip to this button. Also, can I have a button with text instead of the
icon?

Dim cb As CommandBar
Set cb = CommandBars.Add
With cb
.Name = "SWAP"
.Position = msoBarTop
End With

Set myBar = CommandBars("SWAP")
Set myControl = myBar.Controls _
.Add(Type:=msoControlButton, _
Temporary:=True)
With myControl
.FaceId = 47
.Width = 75
.OnAction = "ResetValues"
End With
myBar.Visible = True

Many 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
Custom Toolbar GoogleGirl Excel Programming 1 November 20th 06 06:48 PM
Custom button on custom toolbar wants to re-load "Personal.xls" Aussie Dave Excel Programming 1 March 25th 05 10:19 AM
VBA - Disappearing custom menu and custom toolbar Peter[_50_] Excel Programming 2 December 2nd 04 06:09 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 02:59 PM.

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"