Hiding the Ribbon

aziz rasul

Active member
Local time
Today, 19:57
Joined
Jun 26, 2000
Messages
1,935
I am trying to hide the toolbar of an external MS Access 2010 db. However the code doesn't work.

Code:
        Set dbs = OpenDatabase(strDatabaseName)
        Set appAccess = New Access.Application
        With appAccess
            .OpenCurrentDatabase (strDatabaseName)
            .Visible = True
            .DoCmd.ShowToolbar "Ribbon", acToolbarNo
            .CloseCurrentDatabase
            .Quit
        End With
        Set dbs = Nothing

When I halt the code at

Code:
.DoCmd.ShowToolbar "Ribbon", acToolbarNo

the ribbon disappears but when I open the file after the rest of the code has completed, the ribbon is still there!
 
Put the DoCmd.ShowToolbar "Ribbon", acToolbarNo command AutoExec macro that will lock the ribbon opening the application.

Or upload a ribbon in the system table USysRibbons with the following XML:

Code:
<customUI xmlns="[URL]http://schemas.microsoft.com/office/2009/07/customui[/URL]">
<!-- *** TAG COMMANDS  ***-->
<commands>
   <command idMso="Help" enabled = "false"/>
</commands>
<ribbon startFromScratch="true"/>
<!-- *** BACKSTAGE ***-->
<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 ="TabShare" visible="false"/>
<tab idMso ="TabHelp" visible="false"/>
<button idMso="ApplicationOptionsDialog" visible="false"/>
<button idMso="FileExit" visible="false"/>
</backstage>
</customUI>

Learn to assemble ribbons for high-speed tool and videos from this site:

http://www.ribbon01.com
 
I tried placing the code in an AutoExec macro and that worked a treat. I should have thought of that. Many thanks.

BTW where do you place the XML code that you provided in your post?
 

Users who are viewing this thread

Back
Top Bottom