Results 1 to 5 of 5
  1. #1
    robs23 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    109

    Customizing the ribbon with vba

    Hi Guys,

    I'm currently playing with the ribbon in order to hide it together with backstage options (the menu items available normally in "File"). I made a table where I store 2 ribbon's xmls: "development" & "blank". The code of "blank" is:

    Code:
    <customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">  <ribbon startFromScratch="true">
           <!-- Ribbon XML -->
      </ribbon>
      <backstage>
       <button idMso="FileSave" visible="false"/>
       <button idMso="SaveObjectAs" visible="false"/>
       <button idMso="FileSaveAsCurrentFileFormat" visible="false"/>
       <button idMso="FileOpen" visible="false"/>
       <button idMso="FileCloseDatabase" visible="false"/>
       <tab idMso ="TabInfo" visible="false"/>
       <tab idMso ="TabRecent" visible="false"/>
       <tab idMso ="TabNew" visible="false"/>
       <tab idMso ="TabPrint" visible="false"/>
       <tab idMso ="TabHelp" visible="false"/>
       <button idMso="ApplicationOptionsDialog" visible="false"/>
       <button idMso="FileExit" visible="false"/>
      </backstage>
    </customUI>

    The code of "development" is contrary. Thanks to this, I should be able to hide all options from the user before app deployment and show them back on when in development again. At the opening my database I'm loading my xmls with
    Code:
    Application.loadcustomui
    Afterwards I set active ribbon with
    Code:
    CurrentDb.Properties("CustomRibbonID").value = ribbonName
    I'd like to say it works, because when I check the ribbon name each time it is the one my code had set. What works randomly, however, is the code of my xmls. Sometimes everything is hidden as supposed to, sometimes few tabs or options in "File" menu stays... I don't know what's happening..
    Did anyone observed so peculiar working of this option? Do I do something wrong?



    Robert

  2. #2
    thebigthing313 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    119
    I'm not entirely sure of this behaviour since I load custom ribbons differently. My ribbons load straight from a table called USysRibbons. Each record in USysRibbons is a Ribbon Name (Text primary key), and a memo field with the XML code.

    And then (upon restart of the Database if I just added a new one), I can set my custom ribbon both on Current Database Options under FILE, as well as specific ribbons for specific forms and reports.

    CurrentDB.Properties is always a finicky thing to deal with in my experience. Also, Custom Ribbons usually require a restart of the DB when applied, so the CustomRibbonID property through VBA might be read only, or will not reflect until restart.

  3. #3
    robs23 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    109
    Thanks for your answer. My way of doing is quite alike, I also load xml from table's memo field where each row is for other ribbon. As for now it seems to work correctly though. I think it has to be something with my setup.. I guess more testing is required on my side.

    UPDATE: I get custom ui error when I click "File" tab. Here it is:
    Click image for larger version. 

Name:	customuierror.jpg 
Views:	22 
Size:	45.7 KB 
ID:	18739

    After clicking ok there will be several subsequent error popups like this but dedicated to other item from the xml (like "FileSave", "SaveObjectAs", "FileOpen" etc). Why's that?
    Last edited by robs23; 11-14-2014 at 05:09 PM.

  4. #4
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    India
    Posts
    616
    Try to remove that tab too
    <tab idMso="TabShare" visible="false"/>.
    If you still get the error, remove that Package Sol. Wizard, check with your ribbon code. If it works, may be the addin is the culprit.

  5. #5
    robs23 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    109
    The thing is that I don't want to remove any part of my xml,, it all needs to be there in order to get desired effect. In spite of that I even tried removing this tab from the xml, but other tabs also give same error..

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Customizing the Autonumber field
    By wasim_sono in forum Access
    Replies: 3
    Last Post: 10-24-2014, 03:00 PM
  2. Customizing the Ribbon/Creating Ribbons
    By alexandervj in forum Access
    Replies: 3
    Last Post: 04-01-2014, 04:26 PM
  3. Replies: 3
    Last Post: 08-30-2013, 01:01 PM
  4. Customizing Links to linked Excel data
    By bigmike in forum Import/Export Data
    Replies: 3
    Last Post: 01-28-2013, 03:10 PM
  5. Customizing Database Menus
    By glen in forum Database Design
    Replies: 14
    Last Post: 09-25-2012, 05:18 PM

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