adding custom macro controls to Fluent RibbonUI

G

Guest

Hello again.
I've finally got the menu structure for my customized ribbon menu.
Now I just need to connect the macros I have to each of the items/buttons.
As mentioned yesterday in my last post, I've read the pdf file from that
group in Britain--OALtd. While I see the "getItem..." components, I don't see
anything that specifically identifies how to connect my macros with the
components I made for the ribbon.
How can I do this?
My initialy thoughts would be to use the onAction="pathway to macro, and
macro name". I.e., c:\documents and settings\ user name\ application
data\microsoft\excel\xlstart\filename.xlsb!MacroName
However, the macros are stored in a structure based on ron DeBruin's
macro-module/menu.

how do I accomplish this?
Thank you in advance.
 
R

Ron de Bruin

Hi Steve

If you use my samples in the UI editor you can read that you can click
on the create callbacks button to create the callbacks for every onaction

Copy them in a module of your workbook and add your code
http://www.rondebruin.nl/ribbon.htm

From the site

Generate Callbacks : This will create macros(callbacks) for each onAction you have in your xml.
Select all callbacks and copy them in a normal module in your workbook.
Try this in one of the examples and you will see that it is not so difficult.
After that you can insert the code between the Sub and End Sub line in the macros(callbacks)
 
G

Guest

Ok.
Now, let me ask this:
You show:
onAction="Macro1"

How much of the macro name, or path do I need to include?
I.e., right now, my personal.xlsb 'houses' all of the macros-- this uses
your structure we previously discussed. In that file's macro module are all
of the macros.
My basic assumption is that I'd only include the name of the specific macro.
But as I consider this farther, it seems necessary to tell it where to look
to activate the specific macro.
Again.
Thank you.
 
G

Guest

oops... something I forgot to add.
When I place the onAction command, and validate, I get the error message
that onAction has not been declared.
Everything that I've read thus far says nothing about "pre-declaring" this
command.
i.e., as in VBA where I'd need to do
Dim As ......
Again--- thank you.
 
G

Guest

Ron,
I've done as you described in your examples, and I receive the following
error:
"Wrong number of arguments or invalid property assignment."
As previously mentioned, I've stored all of my macros in the MacroModule you
created with your custom menu we'd discussed before-- the RDB xlsb file-- I
have however changed the name to personal.xlsb.
Because of this, I've tried naming the OnAction="Macro1" two different ways.
1- onAction="personal.xlsb!Macro1"
2- onAction="Macro1"
where Macro1 is my own chosen name for the macro for my test.
The callback in the UI editor shows up fine, but I receive the same above
mentioned error each time.
In fact, for what it's worth, here is the callback statement I receive.

'Callback for button1 onAction
Sub GBS(control as IRibbonControl)
End Sub

I'll be among the first to say that my understanding is real limited here.
The general structure of my menu xlam file worksreally well. I just am not
understanding how to link the macros to the menu buttons/items.

For the sake of discussion I found some older macros that are in my old
personal.xls file.
I choose the same general configuration as above--
onAction="personal.xls!Macro1"
onAction="personal.Macro1"
And
onAction="Macro1"
The callback for the first is identical to the one pasted above.
The second and third give no callbacks.
All three, when activated in excel give me the error I state up top--
"wrong # of arguments, or invalid property."

Again, as always, thank you.
Best.
SteveB.
 
R

Ron de Bruin

Btw: the xml to create the menu is not working in your personal.xlsb.
You can make it a add-in
 
G

Guest

just for final closure,
After speaking with Ron, and having something of an induced epiphany, the
solution to my quandry is:
The file in which the macros reside needs to be saved as the xlam file-- as
described by the OALTD PDF file I mentioned in another post (page 2 or 3).
Open that xlam file in the UI Editor
Using the UI Editor, write out your desired menu structure code, and
save/validate it.
Then to activate/link the macros between the xml code, and the actual
macros, click the generate callback button in the editor.
An example using Ron's custom menu from his website.
He has all of his macros listed on a worksheet-- saved as an xlsb file.
There are three macro modules housing all of the actual macros.
SAve that xlsb file to an xlam file. Design your menu the way you want, and
insert that xml code into the xlam file you just save. Validate, and then
generate your callbacks. you should then have a working ribbon menu.
This appears to be my solution, and I'm considering this matter resolved.
Ron, thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top