AC2007 - Show Built-In Ribbon For Report Only

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • scubasteve
    New Member
    • Jan 2008
    • 13

    AC2007 - Show Built-In Ribbon For Report Only

    Hi,

    I'm having issues with AC2007 custom ribbons.

    I'm building an AC2007 runtime app which has a custom ribbon (called CommandsDisable dHideRibbon) set as the default db ribbon name (see XML at end of post). The aim is to hide as much of the Access interface as possible.

    CommandsDisable dHideRibbon ribbon XML (verified as well-formed by the Office 2007 Custom UI Editor):

    Code:
    <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
    
    <commands>
    <command idMso="FileNewDatabase" enabled="false"/>
    <command idMso="FileCloseDatabase" enabled="false"/>
    <command idMso="ApplicationOptionsDialog" enabled="false"/>
    <command idMso="FileExit" enabled="false"/>
    <command idMso="Help" enabled="false"/>
    </commands>
    
    <ribbon startFromScratch="true">
    </ribbon>
    
    </customUI>
    The app has one report. When that report opens, I want to be able to show the Print Preview ribbon when the report is showing, and hide it when it's done.

    I have 2 issues here.

    1) I need to be able to load a ribbon when the report opens.

    I have this code:

    Code:
    Public Sub ShowCustomRibbon(strRibbonName As String)
      
      Dim strXML As String
      
    On Error GoTo Err_Procedure
      
    'Get ribbon XML.
      strXML = DLookup("[RibbonXML]", "USysRibbons", "[RibbonName] = '" & strRibbonName & "'")
    'Load ribbon.
      Application.LoadCustomUI strRibbonName, strXML
    'Show ribbon.
      CurrentProject.Properties("CustomRibbonID") = strRibbonName
    
    Resume_Procedure:
      On Error GoTo 0
      Exit Sub
    
    Err_Procedure:
      MsgBox "ShowCustomRibbon Error: " & err.Number & " " & err.Description
      GoTo Resume_Procedure
    
    End Sub
    but it causes an error both loading and showing the ribbon.

    2) I'm assuming that to show the print preview ribbon, I'll need to create a custom ribbon in XML that mirrors its functionality. Does anyone know if the XML for the built-in ribbons is available? Or can you just show a built-in one easily?

    3) The Open option is still available from the Office button, even though I believe my XML above should disable it.

    I'm an Access developer, and can usually find the answers to my problems in 10 mins on Google, but there seems to be a lack of useful info about these issues.

    Or, of course, I'm just approaching it in completely the wrong way. If there's a better way, please let me know!

    Thanks in advance.
  • scubasteve
    New Member
    • Jan 2008
    • 13

    #2
    Apologies, the answer to 1) was on these forums at



    And I had 3 issues, not 2.

    So, anyone know the easiest way to show a ribbon with the Print Preview functions available?

    And why my Open menu item is still available?

    Thanks again

    Comment

    • Megalog
      Recognized Expert Contributor
      • Sep 2007
      • 378

      #3
      Hi there..
      I'll have to get back to you on the answer for the Print Preview tab.. I tried a few things quickly on my end and it didnt work... But as far as disabling/hiding native access commands, I use this at the beginning of my custom ribbon. The end-user only gets a 'print' menu, and 'close database' option when they click the Office button.

      After re-reading your post, it seems you're not hiding the Open command, just the New. Add the FileOpenDatabas e command and you should be set.

      Code:
      <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
       <ribbon startFromScratch="true">
        <officeMenu>
         <button idMso="FileOpenDatabase" visible="false"/>
         <button idMso="FileNewDatabase" visible="false"/>
         <splitButton idMso="FileSaveAsMenuAccess" visible="false" />
         <splitButton idMso="FilePrintMenu" visible="true" />
        </officeMenu>
      <insert rest of your custom ribbon code here, if any>
      </ribbon>
      </customUI>

      Comment

      • Megalog
        Recognized Expert Contributor
        • Sep 2007
        • 378

        #4
        As for your Print Preview commands.. you can manually add the native access groups that show up under the Print Preview tab. Some or most of these commands may be disabled until you're actually in print preview mode.

        Here are the group names:

        GroupPrintPrevi ewPrintAccess
        GroupPageLayout Access
        GroupZoom
        GroupPrintPrevi ewData
        GroupPrintPrevi ewClosePreview

        So if you wanted to add the simple 'Print' button group, and the zoom commands group, in their own new tab, you would use this:
        Code:
          <tabs>
          <tab id="tabPrintPreview" label="Custom Print Preview">
            <group idMso="GroupPrintPreviewPrintAccess"></group>
            <group idMso="GroupZoom"></group>
          </tab>
         </tabs>
        You can also add the native commands separately too, if you want to create a custom group.

        If I find out how to get the default access PP tab to show up, or to permanently make it visible, I'll let you know.

        Comment

        • scubasteve
          New Member
          • Jan 2008
          • 13

          #5
          Thanks Megalog, that looks like exactly what I'm after with the Print Preview issue.

          And for pointing out what should have been blatantly obvious about the Open command!

          I'll give it a go later today, and let everyone know how it went.

          Comment

          Working...