I'm having issues with AC2007 custom ribbons.
I'm building an AC2007 runtime app which has a custom ribbon (called CommandsDisabledHideRibbon) 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.
CommandsDisabledHideRibbon ribbon XML (verified as well-formed by the Office 2007 Custom UI Editor):
Expand|Select|Wrap|Line Numbers
- <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>
I have 2 issues here.
1) I need to be able to load a ribbon when the report opens.
I have this code:
Expand|Select|Wrap|Line Numbers
- 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
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.