2007 Ribbon: minimize using code

R

Rusty User

Hi. Does anyone know if the ribbon in Access 2007 can be minimized using
code? I know that it can be hidden using this code:

docmd.ShowToolbar "Ribbon", acToolbarNo

But I just want to minimize it.

Thanks much!
 
A

Albert D. Kallal

Rusty User said:
Hi. Does anyone know if the ribbon in Access 2007 can be minimized using
code? I know that it can be hidden using this code:

docmd.ShowToolbar "Ribbon", acToolbarNo

But I just want to minimize it.

Thanks much!

The only way to do this is sendkeys. Furthermore, I have an application in
which
I want the ribbon minimized for everything EXCEPT reports....

So, I have two functions, one to hide, and one to show.

(and, if the ribbion is already hidden (or showen), then the function does
nothing).

Public Function ShowReportRibbon()

Dim intRibbonState As Variant

intRibbonState = fReturnRegKeyValue(HKEY_CURRENT_USER, _
"Software\Microsoft\Office\12.0\Common\Toolbars\Access", _
"QuickAccessToolbarStyle")

If intRibbonState = 4 Then
' ribbon in auto hide state, show it...
SendKeys "^{F1}", False
DoEvents
End If

End Function

Public Function HideReportRibbon()

Dim intRibbonState As Variant

intRibbonState = fReturnRegKeyValue(HKEY_CURRENT_USER, _
"Software\Microsoft\Office\12.0\Common\Toolbars\Access", _
"QuickAccessToolbarStyle")

If intRibbonState = 0 Then
' ribbon is in full view....hide it...
SendKeys "^{F1}", False
DoEvents
End If

End Function


So, the above does how you how to "read" the state of the ribbion, and if
need be minimiaes it.

So, in the reprots on-load event, we go:

Private Sub Report_Load()

DoCmd.Maximize
ShowReportRibbon

End Sub

And, in the reprots close event, I go:

HideReportRibbon


Note that I am reading the registry in the above via a function called
fReturnRegKeyValue.

that code/function can be found here:

http://www.mvps.org/access/api/api0015.htm

If a user double clicks on a menu group, then the ribbon does un-hide.
However, the instant they use a report....I have re-set it back the way I
want. I suppose the hide ribbon could also be run in the startup form, and
thus you can ensure/control the state of the ribbon this way..

It is not ideal...but, does work quite well so far...
 
R

Rusty User

Thank you so much. I've been gone a long time and I just got back and got
your answer (sorry). I really appreciate your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top