ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to execute macro when selecting user-defined menu in ribbon (https://www.excelbanter.com/excel-programming/443172-how-execute-macro-when-selecting-user-defined-menu-ribbon.html)

Mathieu936

How to execute macro when selecting user-defined menu in ribbon
 
Hi!

I would like to know how to automatically execute a macro when I
select a user-defined tab I created in my Excel ribbon.

I tried onAction tag in my ribbon code for my menu:
<menu id="DropdownBD7020" label="BM7020" size="large"
imageMso="ControlsGallery" onAction="MacroName"

but that doesn't work.


Thanks!

Bob Phillips[_4_]

How to execute macro when selecting user-defined menu in ribbon
 
Matthieu,

I take it you are creating a dropdown in the ribbon in XML.

Can you post the whole XML and the callback code that you have?

--

HTH

Bob

"Mathieu936" wrote in message
...
Hi!

I would like to know how to automatically execute a macro when I
select a user-defined tab I created in my Excel ribbon.

I tried onAction tag in my ribbon code for my menu:
<menu id="DropdownBD7020" label="BM7020" size="large"
imageMso="ControlsGallery" onAction="MacroName"

but that doesn't work.


Thanks!




Mathieu936

How to execute macro when selecting user-defined menu in ribbon
 
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/
customui"
<ribbon
<tabs
<!-- Add-Ins Ribbon Menu --
<tab id="SpecialFunctionsTab" label="My Special Functions"

<!-- Structural Analysis Library Tools Group --
<group id="GroupBD7020" label="BM7020"


<!-- BD7020 Dropdown --
<menu id="DropdownBD7020" label="BM7020 Manual" size="large"
imageMso="ControlsGallery"

<menu id="Menu01GeneralInformation" label="01 General
Information"
<menu id="Menu02StressReportFormat" label="02 Stress
Report Format"
<button id="ReportPWC" label="Stress Report"
onAction="InsertTool" /
</menu
</menu

</menu

</group
</tab
</tabs
</ribbon
</customUI

Mathieu936

How to execute macro when selecting user-defined menu in ribbon
 
On 9 juin, 10:10, Mathieu936 wrote:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/
customui"
*<ribbon
* * <tabs
* * * <!-- Add-Ins Ribbon Menu --
* * * <tab id="SpecialFunctionsTab" label="My Special Functions"

* * * * *<!-- Structural Analysis Library Tools Group --
* * * * *<group id="GroupBD7020" label="BM7020"

* * * * * <!-- BD7020 Dropdown --
* * * * * <menu id="DropdownBD7020" label="BM7020 Manual" size="large"
imageMso="ControlsGallery"

* * * * * * <menu id="Menu01GeneralInformation" label="01 General
Information"
* * * * * * * *<menu id="Menu02StressReportFormat" label="02 Stress
Report Format"
* * * * * * * * * * *<button id="ReportPWC" label="Stress Report"
onAction="InsertTool" /
* * * * * * * * * *</menu
* * * * * * * * </menu

* * * * * * </menu

* * * * *</group
* * * </tab
* * </tabs
* </ribbon
</customUI


any idea?

I would like to change the line <tab id="SpecialFunctionsTab"
label="My Special Functions" for <tab id="SpecialFunctionsTab"
label="My Special Functions" onAction="MyMacro"

However it does'nt work. I tried onAction, onClick, onSelect,
onActivate but nothing works :-(

Jon Peltier[_12_]

How to execute macro when selecting user-defined menu in ribbon
 
If you use a dynamicMenu tag instead of a menu tag, you name a callback
that runs VBA to generate the menu. Within this VBA you could call the
other code you want to run.

I don't know the details off the top of my head, but i made it work
recently based on what's in the book RibbonX by Hennig, Martin, and Puls.

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
774-275-0064
http://peltiertech.com/


On 6/9/2010 9:46 AM, Mathieu936 wrote:
Hi!

I would like to know how to automatically execute a macro when I
select a user-defined tab I created in my Excel ribbon.

I tried onAction tag in my ribbon code for my menu:
<menu id="DropdownBD7020" label="BM7020" size="large"
imageMso="ControlsGallery" onAction="MacroName"

but that doesn't work.


Thanks!


Mathieu936

How to execute macro when selecting user-defined menu in ribbon
 
On 10 juin, 22:39, Jon Peltier wrote:
If you use a dynamicMenu tag instead of a menu tag, you name a callback
that runs VBA to generate the menu. Within this VBA you could call the
other code you want to run.

I don't know the details off the top of my head, but i made it work
recently based on what's in the book RibbonX by Hennig, Martin, and Puls.

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
774-275-0064http://peltiertech.com/

On 6/9/2010 9:46 AM, Mathieu936 wrote:



Hi!


I would like to know how to automatically execute a macro when I
select a user-defined tab I created in my Excel ribbon.


I tried onAction tag in my ribbon code for my menu:
<menu id="DropdownBD7020" label="BM7020" size="large"
imageMso="ControlsGallery" onAction="MacroName"


but that doesn't work.


Thanks!- Masquer le texte des messages précédents -


- Afficher le texte des messages précédents -


Okay thanks, I'll check what I can do..

Bob Phillips[_4_]

How to execute macro when selecting user-defined menu in ribbon
 
I tried to create a workbook with your XML, but it didn't generate the
ribbon for some reason.

--

HTH

Bob

"Mathieu936" wrote in message
...
On 9 juin, 10:10, Mathieu936 wrote:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/
customui"
<ribbon
<tabs
<!-- Add-Ins Ribbon Menu --
<tab id="SpecialFunctionsTab" label="My Special Functions"

<!-- Structural Analysis Library Tools Group --
<group id="GroupBD7020" label="BM7020"

<!-- BD7020 Dropdown --
<menu id="DropdownBD7020" label="BM7020 Manual" size="large"
imageMso="ControlsGallery"

<menu id="Menu01GeneralInformation" label="01 General
Information"
<menu id="Menu02StressReportFormat" label="02 Stress
Report Format"
<button id="ReportPWC" label="Stress Report"
onAction="InsertTool" /
</menu
</menu

</menu

</group
</tab
</tabs
</ribbon
</customUI


any idea?

I would like to change the line <tab id="SpecialFunctionsTab"
label="My Special Functions" for <tab id="SpecialFunctionsTab"
label="My Special Functions" onAction="MyMacro"

However it does'nt work. I tried onAction, onClick, onSelect,
onActivate but nothing works :-(




All times are GMT +1. The time now is 05:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com