Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    RMittelman is offline Advanced
    Windows 10 Access 2016
    Join Date
    Dec 2010
    Location
    Simi Valley, CA
    Posts
    211

    Programming Ribbon in Access 2016

    I have this great idea to replace my Switchboard with a custom ribbon tab. This seems fairly easy by creating a macro for each Switchboard button function, then customizing ribbon by adding new tab called "Menu", then various groups and buttons to this tab. It seems to work properly, but there are some concerns before I can deploy it:



    Googling this, I find articles mentioning an XML file representing the ribbon. Not sure if this is for the built-in ribbon or for custom ribbons I might create. I did not create a custom ribbon, I simply customized the built-in ribbon. Can't find that XML file if it exists.

    I built this ribbon tab in one database, but when I opened another database, it was still there. Obviously it won't work in the other database, because that doesn't have the macros needed to actually open forms or run the particular code. But I only want the ribbon tab to appear in the database it was designed for. Should I have built a custom ribbon instead?

    I also have a couple of groups which only contain Label controls. These will be to display the database version and size respectively. They are not interactive. I don't know how to dynamically load that information to the labels using VBA code.

    Can anybody help me with these concerns, or refer me to any articles that show how to solve them? Thanks...

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    When you modified your ribbon, it was for your version of Access. Pretty sure that if you took that db to another pc you see that your modifications are no where to be found. If you want a particular db to have a modified ribbon, you need to design this for that db, and yes, it will require dealing with xml. There are a Brazillian web pages on this subject, many of them right here in this forum. In fact, I viewed one or two just today. Try a search here, see the 'similar threads' link at the bottom of this page or Google the subject. One of the most straight forward was by Albert D. Kallai (sp) if I recall correctly There are also tools (little apps) to design ribbons if you want to pay for that. If you code your own, I highly recommend you get a decent editor like NotePad++ as it will help you keep things organized. Also, turn on the Access option to display messages for all ribbon errors - Options> Client Settings> General> show add-in user interface errors, or else your ribbon xml might not show as you wish yet report no error.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    sjlevine34's Avatar
    sjlevine34 is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Sep 2020
    Posts
    39
    I found this website that explains how to build a usysRibbons table to contain your ribbon XML code http://accessjitsu.com/custom-ribbon/.

    I have also attached a database containing the usysRibbons table that I built when I migrated an app I had written for my company from Access 2002 to, as I recall, Access 2007. It has been easily 5 or more years since I did this and I haven't done anything with ribbons since, so I am very rusty. But the usysRibbons table will give you an idea of what a once-functioning one looked like.

    DatabaseWithRibbonTable.zip

  4. #4
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,643
    Not too long ago I also went through the tutorials from Access Jitsu. They were pretty good and he explains things very well although the volume level kind of sucked.
    It's definitely worth a watch.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  5. #5
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I think this is a worthwhile read if you roll your own

    http://www.kallal.ca/Ribbon/ribbon.htm
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Also Gunter Avenius has an excellent site at https://www.accessribbon.de/en/.
    Its a German site but with an English section
    Gunter has a ribbon creator app which can be purchased but a free cut down version is available to try. It may be all you need.
    The site also has various examples & tutorials
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  7. #7
    RMittelman is offline Advanced
    Windows 10 Access 2016
    Join Date
    Dec 2010
    Location
    Simi Valley, CA
    Posts
    211
    Thanks to all who pointed me in the right direction. I'm following the Access Jitsu article on creating a custom ribbon.

    Created USysRibbons table. Created simple XML in Visual Studio 15. No syntax errors so far.

    Code:
    <?xml version="1.0" encoding="utf-8" ?> 
    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
      <ribbon startFromScratch="false">
        <tabs>
          <tab id="menu1" label="Menu">
              <group id="enter1" label="Enter">
              <button id="donors1" label="Donors and Donations" size="large" supertip="Enter Donors and Donations"/>
            </group>
            <group id="validate1" label="Validate">
              <button id="addresses1" label="Addresses" size="large" supertip="Validate Donor Addresses"/>
              <button id="emails1" label="Emails" size="large" supertip="Validate Donor Emails"/>
            </group>
          </tab>
        </tabs>
      </ribbon>
    </customUI>
    Pasted that code into the USysRibbons table, and when restarting Access, I get the following error.
    Code:
    Error found in Custom UI XML of "<database name here>"
    
    Line: 3
    Column: 3
    Error Code 0x80004005
    Text is not allowed in the context of element '{http://schemas.microsoft.com/office/2006/01/customui}ribbon' according to DTD/Schema.
    This error appears multiple times, each pointing to a different line number and column.

    I basically just copied the sample XML from the Access Jitsu article, then changed some of the IDs.
    Any idea what is going wrong? Thanks so much...

  8. #8
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    I've never seen that first line used - that I can recall anyway. Also, given your version I would think you'd want 2009 version, unless you're developing for something much older than your version. Your error is probably due to the space before the ? That would be considered 'text'.

    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  9. #9
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Following on from Micron's comment, the next line was for Access 2007 only
    Code:
    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">


    For Access 2010 onwards, you should use:
    Code:
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  10. #10
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Forgot to mention why you'd get the error multiple times even thought it's only 1 mistake:
    each line of code that needs to reference the schema will raise the error - unless I don't understand as much about the schema code line as I thought I did.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  11. #11
    RMittelman is offline Advanced
    Windows 10 Access 2016
    Join Date
    Dec 2010
    Location
    Simi Valley, CA
    Posts
    211
    Thanks for all of the answers. Took out the <?xml..... > tag, changed the schema to 2009/07, and still errors occurred.
    Then I tried removing all of the leading spaces, then it worked:
    Code:
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
    <ribbon startFromScratch="false">
    <tabs>
    <tab id="menu1" label="Menu">
    <group id="enter1" label="Enter">
    <button id="donors1" label="Donors and Donations" size="large" supertip="Enter Donors and Donations"/>
    </group>
    <group id="validate1" label="Validate">
    <button id="addresses1" label="Addresses" size="large" supertip="Validate Donor Addresses"/>
    <button id="emails1" label="Emails" size="large" supertip="Validate Donor Emails"/>
    </group>
    </tab>
    </tabs>
    </ribbon>
    </customUI>
    This is curious, because I thought XML would ignore white space around the tags. Guess not in this instance. Strange, because tutorial showed the xml being designed in Visual Studio then copy-pasted into the USysRibbons table, which I did.

  12. #12
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Then I tried removing all of the leading spaces
    All I did was remove the single space before the ? in "utf-8" ? and it worked for me. You lost me on that comment because I can't see a bunch of spaces in your first code. I didn't look at the tutorial, but did look at a code page for it, and there was no space where I was pointing to.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  13. #13
    RMittelman is offline Advanced
    Windows 10 Access 2016
    Join Date
    Dec 2010
    Location
    Simi Valley, CA
    Posts
    211
    I was referring to the indenting white space on all lines except for first and last. You are right, the original first line with the XML tag is not needed.

    When I removed all of the leading spaces, it worked fine. Now I put them back just using the spacebar in the table column, and it still works fine??!! Perhaps some non-printing character(s) got embedded into that indenting during the copy-paste operation. I've seen that happen before.

    Thanks for all the help!

  14. #14
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    You don't say where you copied from, but yes, might have included tab or new line characters or html. I have no experience with what you used to create the xml so I don't know if it is a proper editor that might have caught it. I use Notepad++.
    Good luck!
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  15. #15
    RMittelman is offline Advanced
    Windows 10 Access 2016
    Join Date
    Dec 2010
    Location
    Simi Valley, CA
    Posts
    211
    Thanks Micron. Now that I think of it, I copied directly from the XML listing in the Access Jitsu article. That may have been the issue. Lately, I load a dummy project in Visual Studio 2016, and open the XML file in that. It seems to work fine. Then I Ctl-A, Ctl-C and paste it directly into the table cell. That works great.

    I think the only remaining issue is to get the tab to the beginning of the list of tabs, and for the new tab to be the active tab. I don't want to set the custom ribbon as "startFromScratch", because we still need the default ribbon functionality. The new custom ribbon tab is put at the right-hand side of the ribbon tabs. The Access Jitsu article says to do this:

    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="OnRibbonLoad">
      <ribbon startFromScratch="false">
        <tabs>
          <tab id="menu" label="Menu" insertBeforeMso="TabHome">
    "TabHome" may be an older Access version ID for the Home tab. I can't seem to find a list of built-in tab IDs for Access/Office 2016 or even 2010.
    Also, I'd like that new custom tab to be the one that opens by default in this database. I tried selecting "Menu" under Options > Current Database > Ribbon and Toolbar Options, but even though it let me choose that in the drop-down, it doesn't actually show that tab. I have to go to the end of the tabs in the ribbon and click on "Menu" to show it. Any ideas???

    Thanks...

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 03-25-2019, 12:59 AM
  2. Replies: 4
    Last Post: 08-07-2018, 05:38 AM
  3. Automating Outlook 2016 from Access 2016
    By jcc285 in forum Programming
    Replies: 10
    Last Post: 09-30-2017, 01:53 PM
  4. Use VBA to Rename a Default Ribbon Tab in Access 2016
    By jeffreymiller in forum Programming
    Replies: 1
    Last Post: 11-18-2016, 08:43 AM
  5. Replies: 4
    Last Post: 05-29-2015, 09:36 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums