Hide and show Ribbon and Navigation Pane

OBBurton

Registered User.
Local time
Yesterday, 22:26
Joined
Dec 26, 2013
Messages
77
Hi, I got this code function for hiding the ribbon and Navigation Pane from this forum at: http://www.access-programmers.co.uk/forums/showthread.php?t=262446&highlight=hiding+navigation+pane+vba It works great for hiding. I had to improvise to un-hide the ribbon, but had no luck with the navigation pane. The original function is:
Code:
Function HideShowRibbon()
    SendKeys "^{F1}", True
    DoCmd.ShowToolbar "Ribbon", acToolbarNo
    DoCmd.NavigateTo "acNavigationCategoryObjectType"
    DoCmd.RunCommand acCmdWindowHide
End Function

The code I used to un-hide is:
Code:
Function ShowRibbon()
    SendKeys "^{F2}", False
    DoCmd.ShowToolbar "Ribbon", acToolbarYes
    DoCmd.NavigateTo "acNavigationCategoryObjectType"
'    DoCmd.RunCommand acCmdWindowUnhide
End Function

I have commented out the DoCmd.RunCommand because it crashes there, the acCmdWindowUnhide not being available. I honestly don't understand all of this code, being a novice, so I guessed a good bit. Can anyone tell me how to unhide the navigation pane?
 
Have you considered having your users access the database using Runtime instead?

This would hide the navigation bar (and users will not be able to see forms in design view) but everything has to be accessible through a switchboard form.
 
Otherwise my guess is that perhaps the computer is unable navigate to a hidden object type and therefore cannot execute the code unhide it?

So I am referring to this line of code:

Code:
DoCmd.NavigateTo "acNavigationCategoryObjectType"

If you want to be able to hide an unhide at will you may have to find another way. For instance, checking to see if the navigation panel is hidden first.
 
I figured out how to unhide the navigation panel after some searching.

This code assumes you are using hide/unhide buttons on a form:

Code:
Private Sub btnHide_Click()

'hide the navigation panel

DoCmd.NavigateTo "acNavigationCategoryObjectType"
DoCmd.RunCommand acCmdWindowHide
End Sub

Private Sub btnUnHide_Click()
'unhide the nav panel

DoCmd.SelectObject acTable, , True
End Sub

The solution was here:

http://social.msdn.microsoft.com/Forums/office/en-US/0a34dbec-5078-4e16-b6a7-78f62c39f1bf/vba-navigation-pane
 
To keep things consistent, in place of NavigateTo, use:
Code:
DoCmd.SelectObject [COLOR="Blue"]acForm[/COLOR], , True
... and acForm instead of acTable.

NB: I'm referring to EternalMyrtle's code.
 
Thanks to vbaInet and EternalMyrtle for your responses!
I got it working both for hide and un-hide of both.
 

Users who are viewing this thread

Back
Top Bottom