Macro to hide/show navigation pane (1 Viewer)

Wysy

Registered User.
Local time
Yesterday, 16:07
Joined
Jul 5, 2015
Messages
333
Hi,
I am struggling with the following.
I have button to show/hide navigation pane:
Private Sub NavWindow_Click()
DoCmd.SelectObject acTable, , True
End Sub

Private Sub NavWindow_DblClick(Cancel As Integer)
DoCmd.SelectObject acTable, , True
DoCmd.RunCommand acCmdWindowHide
End Sub
It works all right. However i would like to have a macro if possible to do the same, so i would be able to "put" that macro into the ribbon.
Is there a solution for it?
thanks
Andrew
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 07:07
Joined
May 7, 2009
Messages
19,237
then use a public function instead. and call it in a macro using runcode
 

Wysy

Registered User.
Local time
Yesterday, 16:07
Joined
Jul 5, 2015
Messages
333
thanks for the answer but i do not know how to use public function.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 07:07
Joined
May 7, 2009
Messages
19,237
on VBE (press Alt-F11 to get there), on menu, insert module. type this:

Public Function fnShowHideNavigationPane(Optional bolShow As Boolean = True) As Variant
DoCmd.SelectObject acTable, , True
If Not bolShow Then DoCmd.RunCommand acCmdWindowHide
End Function


now on your macro->New Action
choose RunCode
function name: fnShowHideNavigationPane([False/True])

[False/True] means you choose true or false. depending on whether you want to show or hide the navigation pane.
 

cadamson8

New member
Local time
Yesterday, 16:07
Joined
May 9, 2020
Messages
1
Thanks Arnel. This is a big help! But there should not be square parentheses around the True / False condition, after the function name. It should be like this:

now on your macro->New Action
choose RunCode
function name: fnShowHideNavigationPane(False/True)
 

Users who are viewing this thread

Top Bottom