Ribbon question

  • Thread starter Thread starter UsenetUser
  • Start date Start date
U

UsenetUser

Any ideas on why this doesn't work? - I don't mean the onaction part -
The immediate problem is the ribbon does not load at all.

<?xml version="1.0" encoding="utf-8" ?>
<customUI
xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="true">
<tabs>
<tab id = "Home" label = "Functions">
<group id = " grp1" label = "Patients">
<button id = "AddPatient" label ="Add Patient " onaction
="ribbonAddPatient "/>
<button id = "EditPatient" label ="Change Patient Information"
onaction ="ribbonEditPatient "/>
</group>
</tab>
</tabs>
</ribbon>
</customUI>
 
Here are the starting lines of code for 2 different ribbons.
The difference between these 2 that work and yours is that you have
<?xml version="1.0" encoding="utf-8" ?>
as an extra line above the first line


sample 1 -->
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"
loadImage="CallBackLoadImage"
onLoad="onRibbonLoad1">
<ribbon startFromScratch="true">
<tabs>


sample 2 -->
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false">
<tabs>



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
Must be some other differences as I took that line out (inserted by
VS2005, BTW) and it still doesn't work.

Also, this one _does_ work
<customUI
xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon>
<contextualTabs>
<tabSet idMso="TabSetFormReportExtensibility">
<tab id="MyTab" label="Report">
<group id="ListCommands" label="Commands">
<button id="cmdHome" label="Home" imageMso="OpenStartPage"
supertip="Return to the Marketing Projects home page." size="large"
onAction="Ribbon.MarketingProjectsHome"/>
<button idMso="FileSendAsAttachment" size="large"/>
<button idMso="PublishToPdfOrEdoc" size="large"/>
</group>
<group idMso="GroupFindAccess"></group>
</tab>
</tabSet>
</contextualTabs>
</ribbon>
</customUI>
 
1st problem:

<group id = " grp1" label = "Patients">

You group id starts with a space...remove it, and you should have:

<group id = "grp1" label = "Patients">

The next error messages I get are about onaction not being legitimate.

You have to use

OnAction....NOT onaction...they are case senstive.

So, remove the space, and changing onaction to onAction, and the ribbon
compiles fine...

Also, your call back syntaxt is wrong. If they are to be standard VBA code,
then use

onaction ="=ribbonEditPatient() "/>

=NameOfFunction()

So, you must place a "=" in front, and MUST follow with ()

So for the above you can/would place a public function in the forms code
module, OR in a standard code module

eg:

Public Function ribbonEditPatient()
 
Thanks Albert, the solution was more involved - I didn't look past the
beginning part of the code.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
Albert,

Some pretty amateurish errors in my post - apologies for that.

I don't understand how you are stepping through the compile process.
What program do you do that in?

Now here is something weird, at least to me. This one loads on one
form, but not another. Should I be thinking 'corrupted form'?

Another issue is mactest, a macro, runs. 'test', whether or not I use
the paretheses, and I see samples like on
http://www.msofficegurus.com/?tag=/access, where they don't, does not
run. The error message is "..can't run.." Is that just a catchall
error message that also may mean 'can't find'?

<customUI
xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="true">
<tabs>
<tab id = "Home" label = "Functions">
<group id = "grp1" label = "Patients">
<button id = "EditPatient" label ="Change Patient
Information" onAction = "test()" />
<button id = "AddPatient" label ="Add Patient" onAction =
"mactest" />
</group>
</tab>
</tabs>
</ribbon>
</customUI>

Thanks,

Peter
 
UsenetUser said:
Albert,

Some pretty amateurish errors in my post - apologies for that.

I don't understand how you are stepping through the compile process.
What program do you do that in?

I am in access. If you turn on UI errors then you get the line number + char
position, and quite a
nice error message.

Turn on UI errors.

Go office button->access options->advanced->

In the "General" section, check the box called:

[ ] Show add-in user interface errors
Another issue is mactest, a macro, runs. 'test', whether or not I use
the paretheses

A macro might work either way, but in my case I don't use macros, I use VBA,
and want the ribbon to call those VBA routines. So, maybe macros are
forgiving in this regards..but call VBA functions directly are not....
 
Back
Top