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

I've been reading about adding custom commands/buttons/macros to a toolbar
and need some help.

I would like to be able to have a macro check for a certain button on the
"Standard" tool bar, and if it's not present, then add the button, and assign
a macro.

Your help would be greatly appreciated. I have tried it using the
techniques I have seen, but obviously I am missing something.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Custom Toolbar

Hi Josh

Delete the button first in the code before you add it with code.
Something like this


Sub MenuBar_Item()
Call MenuBar_Item_Delete

With Application.CommandBars("Standard")
With .Controls.Add(Type:=msoControlButton, temporary:=True, befo=1)
.Style = msoButtonCaption
.Caption = "&Hi"
.TooltipText = "Hi again"
.OnAction = ThisWorkbook.Name & "!TestMacro1"
.Tag = "MyTag1"
End With

End With
End Sub

Sub MenuBar_Item_Delete()
On Error Resume Next
Application.CommandBars.FindControl(Tag:="MyTag1") .Delete
On Error GoTo 0
End Sub


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Josh O." wrote in message ...
I've been reading about adding custom commands/buttons/macros to a toolbar
and need some help.

I would like to be able to have a macro check for a certain button on the
"Standard" tool bar, and if it's not present, then add the button, and assign
a macro.

Your help would be greatly appreciated. I have tried it using the
techniques I have seen, but obviously I am missing something.

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
adding custom images to a button on custom toolbar Mousam Excel Programming 1 July 13th 07 04:28 PM
Custom face for custom toolbar item Allen_N Excel Programming 2 January 9th 07 02:04 PM
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 09:50 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"