PDA

View Full Version : Excel 2007 Ribbon Problem...



amitkumarson
04-30-2012, 12:59 AM
Hi Friends,
I've made two excel addins for excel 2007 version. When its load, automatically a tab called utilities.
I want to know...
1.) Whether we can check its installed or not from vba code.
2.) If its installed then want to add some more group in the same tab.
3.) It its not installed yet, then create new tab called utilities.
I know how to add a new tab or add commands in an existing tab, but I'm not able to check for existing tab's load status

When i load my first addin its working successfully, but when i installed the second addin its make an new tab with the same name.
I've attached the code for both macros

I want to add in existing tab.
Any help on above will be appreciated.

Bob Phillips
04-30-2012, 01:30 AM
I am confused, I see only one workbook, I see no addins, I see n o code in the workbook, so I cannot see any of the things that you describe.

When you load a file with custom XML that custom XML will automatically build your ribbon changes. You cannot add to the ribbon from within VBA, but you can have groups.buttons that are hidden are startup and then become visible from within VBA when some event occurs.

amitkumarson
04-30-2012, 01:45 AM
Wen u start the file, it'll automatically add an tab in ribbon.

As you say, i cannot change or add the ribbon from withing VBA,
I agree, I only want to know if its possible with Custom XML.



I am confused, I see only one workbook, I see no addins, I see n o code in the workbook, so I cannot see any of the things that you describe.

When you load a file with custom XML that custom XML will automatically build your ribbon changes. You cannot add to the ribbon from within VBA, but you can have groups.buttons that are hidden are startup and then become visible from within VBA when some event occurs.

Bob Phillips
04-30-2012, 03:23 AM
Cross-posted at ExcelForum (http://www.excelforum.com/excel-programming/828110-excel-2007-ribbon-problem.html), CodeCage (http://www.thecodecage.com/forumz/microsoft-excel-forum/212581-excel-2007-ribbon-problem.html), and MrExcel (http://www.mrexcel.com/forum/showthread.php?t=632267)(that I know of).

Paul_Hossler
04-30-2012, 04:50 PM
In any good writeup on the Ribbon, there's an explaination of how to use idQ and Namespace that allow two different addins to add to the same custom group—they just need to refer to that custom group by its qualified name



customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" xmlns:x="myNameSpace"

and then

button idQ="x:myButton" …



Paul

Paul_Hossler
04-30-2012, 06:37 PM
Ken has a lot of good information (as always)

http://www.excelguru.ca/blog/2007/03/19/sharing-a-custom-ribbon-tab-among-workbooks/


But this is what I did by saving your Demo as Demo1 and Demo2, then changing the CustomUI, saving both as add ins, and then loading both add ins

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" xmlns:x="myNameSpace">
<ribbon>
<tabs>
<tab idQ="x:TbUtilities" label="Utilities" >
<group idQ="x:Grp1" label="MyGroup">
<button idQ="x:Btnx1" label="Start Data Extraction1" size="normal" onAction="OnCall" image="Import" />
<button idQ="x:Btnx2" label="Settings1" size="normal" onAction="OnCall" image="Settings" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui" xmlns:y="myNameSpace">
<ribbon>
<tabs>
<tab idQ="y:TbUtilities" label="Utilities" >
<group idQ="y:Grp1" label="MyGroup">
<button idQ="y:Btny1" label="Start Data Extraction2" size="normal" onAction="OnCall" image="Import" />
<button idQ="y:Btny2" label="Settings2" size="normal" onAction="OnCall" image="Settings" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>

Paul