Custom Toolbar

MarkAndrews

Well-known Member
Joined
May 2, 2006
Messages
1,970
Office Version
  1. 2010
Platform
  1. Windows
I've seen this done before - haven't got a clue how tho

Basically, to the left of the up & down page navigation, a custom toolbar (permanently fixed) which has a number of custom macro buttons, which only appear when a specific document is opened

Any idea's how to do it?

TIA
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
1. Create a custom toolbar - right-click any toolbar, Customise, then New

2. Once created, again right-click any toolbar and choose Customise. Then with your custom toolbar highlighted, press the Attach button, and in the next dialogue box, attach it to the current file.
 
Upvote 0
Hi mark

What do you want to know? How to set up the toolbar, or how to anchor it in place? It is likely to be a macro tied to the Workbook_Open event that sets up the toolbar "on the fly" and removes it when the file is closed.

Have a look at this code :

Code:
Sub MakeMenu()
On Error Resume Next
Application.CommandBars("Marks Toolbar").Delete
On Error GoTo 0
Set TB = Application.CommandBars.Add(Name:="Marks Toolbar")
Set Btn = TB.Controls.Add(Type:=msoControlButton)
With Btn
.FaceId = 71
.TooltipText = "Marks Button1"
.OnAction = "MarksMacro1"
End With
Set Btn = TB.Controls.Add(Type:=msoControlButton)
With Btn
.FaceId = 72
.TooltipText = "Marks Button1"
.OnAction = "MarksMacro2"
End With
With Application.CommandBars("Marks Toolbar")
.Visible = True
End With
End Sub

Sub DeleteMenu()
Application.CommandBars("Marks Toolbar").Delete
End Sub

HTH

DominicB
 
Upvote 0
1. Create a custom toolbar - right-click any toolbar, Customise, then New

2. Once created, again right-click any toolbar and choose Customise. Then with your custom toolbar highlighted, press the Attach button, and in the next dialogue box, attach it to the current file.

Neil, Thanks for this -sadly not what i'm after, as I know how to do this

Thanks again tho
 
Upvote 0
Hi mark

What do you want to know? How to set up the toolbar, or how to anchor it in place? It is likely to be a macro tied to the Workbook_Open event that sets up the toolbar "on the fly" and removes it when the file is closed.

Have a look at this code :

Code:
Sub MakeMenu()
On Error Resume Next
Application.CommandBars("Marks Toolbar").Delete
On Error GoTo 0
Set TB = Application.CommandBars.Add(Name:="Marks Toolbar")
Set Btn = TB.Controls.Add(Type:=msoControlButton)
With Btn
.FaceId = 71
.TooltipText = "Marks Button1"
.OnAction = "MarksMacro1"
End With
Set Btn = TB.Controls.Add(Type:=msoControlButton)
With Btn
.FaceId = 72
.TooltipText = "Marks Button1"
.OnAction = "MarksMacro2"
End With
With Application.CommandBars("Marks Toolbar")
.Visible = True
End With
End Sub

Sub DeleteMenu()
Application.CommandBars("Marks Toolbar").Delete
End Sub

HTH

DominicB

This is great! How do I anchor the newly created toolbar to the left of the screen? or vice versa?

How things mate?
TIA
 
Upvote 0
Hi Mark

Something like :

With Application.CommandBars("Marks Toolbar")
.Position = xx
.RowIndex = xx
.Top = xx
.Left = xx
End With

Move the toolbar you want it and use this utility to give you the coordinates for the above settings :

Code:
Sub test()
With Application.CommandBars("Marks Toolbar")
msg = "Position : " & .Position & Chr(13)
msg = msg & "RowIndex : " & .RowIndex & Chr(13)
msg = msg & "Top : " & .Top & Chr(13)
msg = msg & "Left : " & .Left
MsgBox msg
End With
End Sub

HTH

DominicB
 
Upvote 0
Also, can i change the toolbar name? from "Marks Toolbar"

Tried & failed - it no like...... :cry:
 
Upvote 0
When i try and change "Marks Toolbar" to (presumably) rename the toolbar text it doesn't like

Code:
Private Sub Workbook_Open()

Application.ScreenUpdating = False
Application.StatusBar = "Designed By Mark Andrews"
ActiveWorkbook.Save
ActiveWorkbook.RefreshAll
On Error Resume Next
Application.CommandBars("Marks Toolbar").Delete
On Error GoTo 0
Set TB = Application.CommandBars.Add(Name:="Marks Toolbar")
Set Btn = TB.Controls.Add(Type:=msoControlButton)
With Btn
.FaceId = 71
.TooltipText = "Marks Button1"
.OnAction = "MarksMacro1"
End With
Set Btn = TB.Controls.Add(Type:=msoControlButton)
With Btn
.FaceId = 72
.TooltipText = "Marks Button1"
.OnAction = "MarksMacro2"
End With
With Application.CommandBars("Marks Toolbar")
.Visible = True
Application.ScreenUpdating = True
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,729
Messages
6,126,525
Members
449,316
Latest member
sravya

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top