[AccessD] Show the print preview ribbon

Gustav Brock gustav at cactus.dk
Sat Mar 1 02:11:05 CST 2014


Hi Rocky

As I understand it, you cannot rely on SendKeys (don't know why). 
So I posted this a year ago which has worked fine for me:

<code>
 Public Function EnableRibbon(Optional ByVal varEnable As Variant) As Boolean

 ' Set or toggle if the Ribbon should be collapsed or enabled.
 '
 ' 2013-02-08. Cactus Data ApS, CPH.
 '
 ' Can be used with AutoExec macro to minimize the Ribbon at launch:
 '   EnableRibbon(False)

     ' Height of Ribbon when enabled: 141
     ' Height of Ribbon when collapsed: 53
     Const clngRibbonHeight  As Long = 97
     Const cstrRibbonName    As String = "Ribbon"
     
     Dim booEnabled          As Boolean
     
     ' Continue on error and toggle the collapsing of the Ribbon.
     On Error Resume Next
     
     ' Make the Ribbon visible as a hidden ribbon cannot be controlled.
     DoCmd.ShowToolbar cstrRibbonName, acToolbarYes
     
     ' Measure if the Ribbon is collapsed or enabled.
     booEnabled = (Application.CommandBars(cstrRibbonName).Height >
 clngRibbonHeight)
     
     If IsMissing(varEnable) Or (booEnabled Xor CBool(varEnable)) Then
         ' Toggle the collapsing of the Ribbon.
         CommandBars.ExecuteMso "MinimizeRibbon"
         booEnabled = Not booEnabled
     End If
     
     ' Return the current state of the Ribbon.
     EnableRibbon = booEnabled
     
 End Function
 </code>

 /gustav

________________________________________
Fra: accessd-bounces at databaseadvisors.com <accessd-bounces at databaseadvisors.com> på vegne af Rocky Smolin <rockysmolin at bchacc.com>
Sendt: 1. marts 2014 07:12
Til: 'Access Developers discussion and problem solving'
Emne: Re: [AccessD] Show the print preview ribbon

Any way to maximize the ribbon?  I'd like to maximize the Print Preview
ribbon in the open even of a report.

Tia

r



More information about the AccessD mailing list