PDA

View Full Version : VBA question about Toolbar...



Exposian
05-11-2015, 06:34 AM
Hi all,

I have a little question about toolbar. How do I add a "separator", or split into group 2 buttons on my toolbar? Example of my two buttons below I'd like to split with a "separator"

Hope that make sense : (

Regards to all,
Philippe



With .Add(Type:=msoControlButton)
.Caption = "Move Up"
.Style = msoButtonIcon
.OnAction = "MoveUp"
.FaceId = 3274
End With
With .Add(Type:=msoControlButton)
.Caption = "Move Down"
.Style = msoButtonIcon
.OnAction = "MoveDown"
.FaceId = 3275
End With

John Wilson
05-11-2015, 07:31 AM
In versions after 2003 you should be using XML to create ribbon controls not legacy code unless you are also targetting earlier versions

Have a quick look at this example. You can download the free program CustomUI Editor to read the XML (and write more) Just Google

this is the best book by far (most is relevant to 2010 / 2013)
http://www.amazon.co.uk/RibbonX-Customizing-Office-2007-Ribbon/dp/0470191112

Exposian
05-11-2015, 08:49 AM
Thanks John, yes this toolbar I build is aimed also at older version, I just wondered how I could split those two button with a bar "|" or something like that to help users.

Regards,
Philippe

John Wilson
05-11-2015, 09:23 AM
Don't believe it's possible in legacy code (I don't really code much for 2003 though)

It's simple in XML but of course this only works in ribbon versions

John Wilson
05-11-2015, 09:26 AM
Someone is telling me here that you can use BeginGroup but I haven't tried at all.

'ADD SEPERATOR <==============
.BeginGroup = True
.Caption = "Update Status Report"
.OnAction = "MyMacro2"

Exposian
05-11-2015, 09:37 AM
Thanks a lot John! Yes I have tried .BeginGroup. It works on dropmenu but not on the toolbar itself..

Many thanks for your help once again!

Regards,
Philippe

Andy Pope
05-12-2015, 04:41 AM
Begin group works for me in ppt2003



With .Add(Type:=msoControlButton)
.Caption = "Move Up"
.Style = msoButtonIcon
.OnAction = "MoveUp"
.FaceId = 3274
End With
With .Add(Type:=msoControlButton)
.Caption = "Move Down"
.Style = msoButtonIcon
.OnAction = "MoveDown"
.FaceId = 3275
.BeginGroup = True
End With