LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default CommandBars.Add problem

I am trying to create a toolbar with a button on it in the Workbook.Activate
event. Below is the code so far. I error out at the With TBar .Name line so I
don't know if anything else is wrong. Help would be greately appreciated.

Sub MakeToolbarBtn()
'
' Create new toolbar and button
Dim TBar As CommandBar
Dim NewBtn As CommandBarButton

Set TBar = CommandBars.Add
With TBar
.Name = "WWEnviro"
.Top = 0
.Left = 0
.Visible = True
End With

Set NewBtn = CommandBars("WWEnviro").Controls.Add _
(Type:=msoControlButton)
With NewBtn
.FaceId = 300
.OnAction = "FixIt"
.Caption = "FixFormatting"
End With
On Error Resume Next
'On Error GoTo 0

End Sub

Thank you
 
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
VBA problem with CommandBars zuEgg Excel Programming 5 July 28th 06 04:47 PM
commandbars in add-in Geoff Excel Programming 0 June 19th 06 09:28 PM
Commandbars dynamic menu creation problem GusEvans Excel Programming 6 April 6th 06 07:21 PM
CommandBars vs CommandBars(1).Controls Sean Excel Programming 3 April 3rd 06 01:34 PM
CommandBars garry Excel Programming 3 June 24th 04 03:12 PM


All times are GMT +1. The time now is 07:59 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"