View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Eager2Learn Eager2Learn is offline
external usenet poster
 
Posts: 1
Default Creating a CommandBar - what's wrong?

I am working on creating a commandbar and buttons upon the workshee
opening, and then delete it when the worksheet closes. I am new a
this, and running into a problem.

Here is my code so far, it doesn't work. In the Workbook_Open I put
Call to this:


Private Sub CreateCommandBar()
Dim TBar As CommandBar
Set TBar = CommandBars.Add
With TBar
.Name = "OPLToolBar"
.Top = 0
.Left = 0
.Visible = True
End With

Set NewBtn1 = CommandBars("OPLToolBar").Controls.Add _
(Type:=msoControlButton)
With NewBtn1
.FaceId = 481
.OnAction = "Sort"
.Caption = "Main Sort"
.Style = msoButtonIconAndCaption
End With

End Sub

Thanks in advance for the help.
Jonatha

--
Message posted from http://www.ExcelForum.com