Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Macro code to create a toolbar?

I know this is possible and easily findable; don't bother googling it as I do
not wish to take that much time from you guys (for such simple question).
Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Macro code to create a toolbar?

Try some code similar to the following:


Sub AAA()
Dim CBar As Office.CommandBar
Dim C1 As Office.CommandBarButton
Dim C2 As Office.CommandBarButton
Dim C3 As Office.CommandBarButton

On Error Resume Next
Application.CommandBars("MyName").Delete
On Error GoTo 0

Set CBar = Application.CommandBars.Add( _
Name:="MyName", temporary:=True)
Set C1 = CBar.Controls.Add(Type:=msoControlButton, _
temporary:=True)
With C1
.Caption = "One"
.OnAction = "'" & ThisWorkbook.Name & "!ProcedureOne"
.Style = msoButtonCaption
End With
Set C2 = CBar.Controls.Add(Type:=msoControlButton, _
temporary:=True)
With C2
.Caption = "Two"
.OnAction = "'" & ThisWorkbook.Name & "!ProcedureTwo"
.Style = msoButtonCaption
End With
Set C3 = CBar.Controls.Add(Type:=msoControlButton, _
temporary:=True)
With C3
.Caption = "Three"
.OnAction = "'" & ThisWorkbook.Name & "!ProcedureThree"
.Style = msoButtonCaption
End With
CBar.Visible = True
End Sub


Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Thu, 23 Oct 2008 15:19:01 -0700, Do what I can, but I''m only one
man. om wrote:

I know this is possible and easily findable; don't bother googling it as I do
not wish to take that much time from you guys (for such simple question).
Thanks in advance.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Macro code to create a toolbar?

I love your MVP website. Thank you Mr. Pearson.

"Chip Pearson" wrote:

Try some code similar to the following:


Sub AAA()
Dim CBar As Office.CommandBar
Dim C1 As Office.CommandBarButton
Dim C2 As Office.CommandBarButton
Dim C3 As Office.CommandBarButton

On Error Resume Next
Application.CommandBars("MyName").Delete
On Error GoTo 0

Set CBar = Application.CommandBars.Add( _
Name:="MyName", temporary:=True)
Set C1 = CBar.Controls.Add(Type:=msoControlButton, _
temporary:=True)
With C1
.Caption = "One"
.OnAction = "'" & ThisWorkbook.Name & "!ProcedureOne"
.Style = msoButtonCaption
End With
Set C2 = CBar.Controls.Add(Type:=msoControlButton, _
temporary:=True)
With C2
.Caption = "Two"
.OnAction = "'" & ThisWorkbook.Name & "!ProcedureTwo"
.Style = msoButtonCaption
End With
Set C3 = CBar.Controls.Add(Type:=msoControlButton, _
temporary:=True)
With C3
.Caption = "Three"
.OnAction = "'" & ThisWorkbook.Name & "!ProcedureThree"
.Style = msoButtonCaption
End With
CBar.Visible = True
End Sub


Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Thu, 23 Oct 2008 15:19:01 -0700, Do what I can, but I''m only one
man. om wrote:

I know this is possible and easily findable; don't bother googling it as I do
not wish to take that much time from you guys (for such simple question).
Thanks in advance.


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Macro code to create a toolbar?

If you google for yourself you don't take any time from "us guys".


Gord Dibben MS Excel MVP

On Thu, 23 Oct 2008 15:19:01 -0700, Do what I can, but I''m only one man.
om wrote:

I know this is possible and easily findable; don't bother googling it as I do
not wish to take that much time from you guys (for such simple question).
Thanks in advance.


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
Can I create a command box fora macro to be stored on my toolbar Barb Reinhardt New Users to Excel 0 May 15th 07 01:24 AM
Can I create a command box fora macro to be stored on my toolbar Office Junior New Users to Excel 0 May 11th 07 12:01 PM
code to reassign a macro to a toolbar button because of path change Almagg via OfficeKB.com Excel Discussion (Misc queries) 0 April 27th 07 06:42 PM
How to create a form to insert a hyerlink.VBA code to create a for karthi Excel Discussion (Misc queries) 0 July 5th 06 11:26 AM
How do you create a pdf toolbar on excel? Jac Excel Discussion (Misc queries) 1 March 17th 06 09:44 AM


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