[AccessD] A2007 - Programmatically Minimize Ribbon

Rocky Smolin at Beach Access Software rockysmolin at bchacc.com
Thu Feb 5 12:54:17 CST 2009


Stuart:

Well, dang.  It doesn't work.  I put Call MinimizeRibbon in the _Open event,
but the ribbon ended up maximized anyway.   SO I moved it right at the end
of the _Open event on the theory that maybe some of the housekeeping
(resizing the form, maximizing the form, etc.) was affecting the ribbon.
But no soap.

So I moved it to the _Activate event.  Same result.  So I put MsgBox
RibbonMinimized in the RibbonMinimized Function to see what the value was on
the call.  With the Call to MinimizeRibbon in the Activate event, it gets
called 3 times.  Each time the value of RibbonMinimized is True and the
ribbon is indeed minimized.  

Then right at the end of the opening process, the ribbon re-appears.  

Ctrl-F1 from the keyboard toggles the ribbon nicely.  And the code looks
like it should work.  And I stepped through it just to see what it was
doing.  

Any ideas what's going on?  


Rocky Smolin
Beach Access Software
858-259-4334
www.e-z-mrp.com
www.bchacc.com
 
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: Wednesday, February 04, 2009 7:15 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] A2007 - Programmatically Minimize Ribbon

Rocky!

This was answered  two months ago when you asked about "turning off the
ribbons programmatically"

Here's what I posted then:
My Height was slightly different to those in the link, probably because of
different screen resolutions, fonts etc but it looks like it will always be
above/below 100 so this should work anywhere. It certainly works for me:  

Function RibbonMinimized() As Boolean
RibbonMinimized = Application.CommandBars("Ribbon").Height < 100 End
Function

The following four functions give you full control over the Ribbon :-)

Function HideRibbon()
       DoCmd.ShowToolbar "Ribbon", acToolbarNo End Function

Function ShowRibbon()
       DoCmd.ShowToolbar "Ribbon", acToolbarYes End Function

Function MinimizeRibbon()
    If Not RibbonMinimized Then SendKeys "^{F1}"
    End If
End Function

Function MaximizeRibbon()
    If RibbonMinimized Then SendKeys "^{F1}"
    End If
End Function


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list