Help! My 1st Ribbon

schu7044

Registered User.
Local time
Today, 14:04
Joined
Jan 31, 2008
Messages
14
I am attempting my 1st Ribbon. I have the USysRibbons table set up and I’m using the following XML:

<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="tabEntryForm" label="Entry Form Options">
<group id="grpEntryForm" label="Create Initial Record">
<button id="btnCreateInitialRecord" size="large" label=" "
imageMso="BevelShapeGallery"
onAction="onClickCreateInitialRecord"/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>

I have the following callback function in a module:

Public Function onClickCreateInitialRecord(ctrl As IRibbonControl)
{Do some stuff in here}
End Function

When I click the button I receive the following error:

Can’t run the macro or callback function ‘onClickCreateInitialRecord’
Make sure the macro or function exists and takes the correct parameters.

Where am I going wrong?

Thank you,

Don
 
Change to this:
Code:
Sub onClickCreateInitialRecord(ctrl As IRibbonControl)
Ribbon controls don't use functions, they use sub-routines as their callback.
 
Hi

I would like to make a invite:
Visit my recent http://www.ribbon01.com site and watch my video-free classes on ribbons.

In the second instructional video explains in detail about your question

To learn more about custom ribbons, visit the article below and download the sample. Although this in Portuguese, I believe that helps.

http://www.usandoaccess.com.br/tutor...sp?id=1#inicio

Success
 
I changed the function to a sub, and get the same message. I will attempt to attach the DB to this post.

Thank you so much for your help.
 

Attachments

Last edited:
hi

have to enable the reference: MICROSOFT 12.0 OBJECT LIBRARY (14.0 to Access 2010)

If you read my articles and watch my videos, you'll learn fast.

Success
 
Avelino: your video's are spoken in English, but the database is not. Is this just an example?
 
I found this site a long time ago when I created my first ribbon. This fella wrote an app to do most of the common ribbon creating stuff (kinda like making menus in 2003).

http://ribboncustomizer.clatonh.com/Main.aspx

It had some issues but got me going in the direction I needed to go. That is, having no XML experience I created the basic ribbon using his utility and then anaylyzing the output to understand what was going on and was able to complete the rest. It helped me demystify everything.

It has gone through several revisions since I first used it so it might be better now. Anyhow posting it so for other readers, etc.

-dK
 
Change to this:
Code:
Sub onClickCreateInitialRecord(ctrl As IRibbonControl)
Ribbon controls don't use functions, they use sub-routines as their callback.

Hi

I disagree with your comment. Ribbons use functions just fine. My ribbons use functions without problem.

Nigel
 
Hi

I don't think you've declared the ribbon as an object as it's not in your XML.

Something like in your XML-
Code:
<customUI
xmlns="http://schemas.Microsoft.com/office/2006/01/customui" onLoad= "rxIRibbonUI_onLoad">

then you need a global declaration
Code:
Public grxIRibbonUI As RibbonUI

then the code that runs it all as the ribbon starts
Code:
Sub rxIRibbonUI_onLoad(ribbon As IRibbonUI)
Set grxIRibbonui = ribbon
End Sub

then this should fire up your ribbon declaration and anything running as a ribbon command. Look up my posts. I made an extensive and comprehensive tutorial of ribbon examples and how to invoke different commands and methods of setting up custom ribbons.

Nidge
 
Hi

I disagree with your comment. Ribbons use functions just fine. My ribbons use functions without problem.

Nigel
Correct Nigel. There are circumstances where a function is useful as callbacks for a ribbon, but in the OP's case it wasn't necessary. I've actually had problems in the past using functions when using COM-Addins to build the ribbon, can't quite remember what it was. I had to revert back to subs.
 
Hi Nigel

Load the ribbon in the cache does not make sense for the case. By chance he is requesting amendment of the controls at runtime? I think he has to walk a little more to start using the get (getLabel, getVisible, ..)

I agree that we can use functions without problems but the vbaInet is correct in stating that he uses sub-routines as their callback (onAction, onChange, onLoad, loadImage, ...). It makes sense to use functions, if not return values.

success
 

Users who are viewing this thread

Back
Top Bottom