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 ;)):



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!
 

Some videos you may like

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

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.
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,212
Messages
5,509,866
Members
408,757
Latest member
Jamarr123

This Week's Hot Topics

  • Turn fraction around
    Hello I need to turn a fraction around, for example I have 1/3 but I need to present as 3/1
  • TIme Clock record reformatting to ???
    Hello All, I'd like some help formatting this (Tbl-A)(Loaded via Power Query) [ATTACH type="full" width="511px" alt="PQdata.png"]22252[/ATTACH]...
  • TextBox Match
    hi, I am having a few issues with my code below, what I need it to do is when they enter a value in textbox8 (QTY) either 1,2 or 3 the 3 textboxes...
  • Using Large function based on Multiple Criteria
    Hello, I can't seem to get a Large formula to work based on two criteria's. I can easily get a oldest value based one value, but I'm struggling...
  • Can you check my code please
    Hi, Im going round in circles with a Compil Error End With Without With Here is the code [CODE=rich] Private Sub...
  • Combining 2 pivot tables into 1 chart
    Hello everyone, My question sounds simple but I do not know the answer. I have 2 pivot tables and 2 charts that go with this. However I want to...
Top