[AccessD] New engagement; trying to avoid the "tip of the iceberg" consulting trap

Stuart McLachlan stuart at lexacorp.com.pg
Tue Nov 9 15:41:40 CST 2010


It's gets a  bit kludgy, but you can control the ribbon in VBA.

>From a post by me to the  the list on 4 Dec 2008:

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




On 9 Nov 2010 at 16:00, Mark Simms wrote:

> Yes Susan, it worked fine saved as an MDB from AC2007. They utilized
> zero 2007 features as far as I can see.
> 
> Interestingly, in this project, there is a good reason to use compiler
> directives to handle things like turning off the ribbon which only
> works in 2007. In that regard, I change one line of code, and the code
> will be interpreted under 2007. ' place this at the top of a module
> #Const VERSION = 2003
> 
> #If VERSION = 2007 Then
>   ' add code to remove ribbon here
> #End If
> 
> Problem is: I don't think there's a way in VBA to remove the ribbon,
> is there ? I saw the manual method...ughh...it's a cludge...creating a
> blank ribbon. 



More information about the AccessD mailing list