Changing the height/layout of custom ribbons

piggeh

New Member
Joined
Jul 7, 2010
Messages
11
I have created a custom ribbon in access with only a couple of options within the group, and with small (well, 'normal' sized icons). What I wanted was for this to stretch across the screen, one button at a time. However at the moment they appear like this (excuse the names, smiley wont make the proper release ;)):

ribsc.jpg


Is it possible to get the buttons side by side using these small icons? I don't want the ribbon to take up as much room on the page as it looks a bit ugly having so much blue space to the right of only a couple of buttons!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
You do have the option to use large icons, which will force them to take up more space. Alternatively you can put a separator between each menu item.
Did you build the ribbon by hand or using a utility tool?

Denis
 

piggeh

New Member
Joined
Jul 7, 2010
Messages
11
I used an online tutorial and then plan to add my own icons (I added the one for print macro), but I only need 2 or 3 icons in total. It's just all the blue space to the right looks very wasteful. Code currently is:
Code:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false" >
<tabs>
<tab idMso="TabCreate" visible="false" />
<tab id="dbCustomTab" label="Custom Tab" visible="true">
<group id="dbCustomGroup" label="Custom Group">
<button idMso="Paste" imageMso="Paste" label="Built-in Paste" size="normal" enabled="true" />
<button imageMso="HappyFace" size="normal" label="smiley!" idMso="Cut" />
<button id="printPO" onAction="macro" label="print" size="normal" imageMso="Paste" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>
 
Last edited:

piggeh

New Member
Joined
Jul 7, 2010
Messages
11
The only other thing was I wanted to link to a function rather than a macro but couldnt work out how to reference it. I have a function Command41_Click() and tried to reference as Command41 or Command41_Click but no dice. I've just used a macro for now, it's no biggy but would be good to know how to reference functions correctly.
 

piggeh

New Member
Joined
Jul 7, 2010
Messages
11

ADVERTISEMENT

seperators put one alongside another, but still a lot of empty space. I guess what I really need to do is either be able to specify the height of the ribbon to force it to show them side by side rather than one on top of the other.
 

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
You can't specify the height of the ribbon AFAIK -- that's fixed. See what happens if you change size=normal to size=large for the icons.
Also, you can get the Custom UI editor to generate the callback functions for you so you can use VBA instead of macros.
Another option is to take the button click function off the form where it lives, put it into a standard module and make it public.
You can then use the RunCode action in a macro to call the function.

Denis
 

piggeh

New Member
Joined
Jul 7, 2010
Messages
11

ADVERTISEMENT

Thakns Denis, guess I'll make the icons large, will have to do. Thanks for the advice on macro RunCode usage will probably do it that way as looks pretty easy to do without learning about custom UI editors :p
 

Lewiy

Well-known Member
Joined
Jan 5, 2007
Messages
4,284
You can use the box element to help formatting the position of controls on the ribbon. Give this a go.

Code:
Put some controls in here
</BOX>

A box can be either horizontal or vertical so you can force "white space" into the ribbon to spread things out a bit.

 
Last edited:

Lewiy

Well-known Member
Joined
Jan 5, 2007
Messages
4,284
Ok, I give up trying to get the XML to show properly, but have a look at the box element anyway!!
 

piggeh

New Member
Joined
Jul 7, 2010
Messages
11
Ok, I give up trying to get the XML to show properly, but have a look at the box element anyway!!

It seems to mess up displaying it sometimes, and other times is ok! Will look up the box element, cheers.
 

Watch MrExcel Video

Forum statistics

Threads
1,133,579
Messages
5,659,629
Members
418,517
Latest member
LordWiader

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
Top