Results 1 to 11 of 11
  1. #1
    New Lounger
    Join Date
    Jun 2012
    Posts
    11
    Thanks
    1
    Thanked 1 Time in 1 Post

    Adding to the Access 2007 Ribbon: First Effort

    I'm a veteran Access/VBA/Sql Server programmer taking my first crack at adding to the ribbon in Access 2007, or creating a new one (preferred). I've been following the standard reference documentation from Microsoft and from a couple of books, but they are only getting me to third base. Can anyone help me get to home?

    I'm using the .LoadCustomUI method with VBA code. I'm able to successfully load my ribbon name into the RibbonName drop-down in Access Options; I able to do the same with forms. But in no case am I able to see any changes! Here is the XML code I am using for my test:

    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
    <ribbon startFromScratch="true">
    <tabs>
    <tab id="DalesTab" label="DALES TAB" visible="true">
    <group id="TestTabs" label="TEST TABS">
    <button id="Test1Button" label="TEST BUTTON 1" onAction="subHandleOnAction" tag="Test1"/>
    </group>
    </tab>
    </tabs>
    </ribbon>
    </customUI>

    I have this code generated by a variable xml, so I invoke the method with

    Application.LoadCustomUI "DalesTab", xml

    Is there a problem in the code? Of course I am doing the obvious things like loading the code, selecting the ribbon name, exiting, then rerunning. What else?

    Dale Napier
    Last edited by LasVegan; 2012-06-07 at 14:42.

  2. #2
    New Lounger
    Join Date
    Dec 2009
    Location
    Sherwood, OR, USA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Did you see this post? http://msdn.microsoft.com/en-us/libr...lopers_Runtime

    Another way is to use the USysRibbons table and added you xml as a record. Then you can use this code Me.RibbonName = "RibbonName"
    Jack

  3. #3
    New Lounger
    Join Date
    Jun 2012
    Posts
    11
    Thanks
    1
    Thanked 1 Time in 1 Post
    In the end I determined my problems were in imperfect XML. The question is, is there an easier way to debug the XML rather than just looking at it over and over again? I miss my VBA debugger.

  4. #4
    New Lounger
    Join Date
    Jun 2012
    Posts
    11
    Thanks
    1
    Thanked 1 Time in 1 Post
    Jack, where would that code go and what does the Me. object refer to in this context?

  5. #5
    New Lounger
    Join Date
    Dec 2009
    Location
    Sherwood, OR, USA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The Me refers to the form where I had put a button to test changing ribbons on.
    Jack

  6. #6
    New Lounger
    Join Date
    Dec 2009
    Location
    Sherwood, OR, USA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have seen nothing for debuging XML.

    There are some tools for creating ribbons and using a XML editor would also help to write proper XML. It is also possible to create a ribbon in Access 2010 and then save it to a file. Helen Feddema has a sample showing how to add graphics and use callback functions...see Chapters 15 and 16 of her book "Access 2007 VBA Programmer's Reference" Chapter 12 . http://www.wiley.com/WileyCDA/WileyT...-DOWNLOAD.html
    Last edited by JackStockton; 2012-06-09 at 11:56. Reason: wrong chapter entered
    Jack

  7. #7
    New Lounger
    Join Date
    Jun 2012
    Posts
    11
    Thanks
    1
    Thanked 1 Time in 1 Post
    Thanks for the info. I appreciate the support here and am working to reciprocate.

    I have now written customer functional XML from a database using VBA. HOWEVER, I am still struggling with getting the code to execute my callback subroutine. What is required to make the XML code recognize the existence of a callback subroutine?

    Dale

  8. #8
    New Lounger
    Join Date
    Dec 2009
    Location
    Sherwood, OR, USA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Did you look at Helen Feddema's example.
    Jack

  9. #9
    New Lounger
    Join Date
    Jun 2012
    Posts
    11
    Thanks
    1
    Thanked 1 Time in 1 Post
    Doesn't ring a bell. Where can I look for it?

  10. #10
    New Lounger
    Join Date
    Dec 2009
    Location
    Sherwood, OR, USA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    In my post above I put a link to where you can purchase from Wiley, or download the code samples.
    Jack

  11. #11
    New Lounger
    Join Date
    Jun 2012
    Posts
    11
    Thanks
    1
    Thanked 1 Time in 1 Post
    There's something about this forum that is extremely therapeutic ... I kill myself trying to solve a problem, and within minutes after posting here, I solve it myself! Which is to say, I've solved this problem too.

    The solution: make sure to include a parameter call in the callback function:

    public sub subDatadoc(ctrl as IRibbonControl)
    ... code
    end sub

    Also, I thought I had selected the Office 12 reference, and I had not; got it wrong. These two items together solved it. Doh!

    Hope someone gets some benefit from reading of these foibles. It's a lot easier than reading the manuals! And tends to get the point much more quickly.

    Dale

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
  •