Unable to activate menubar

Kevin Robson

Registered User.
Local time
Today, 19:48
Joined
Feb 4, 2004
Messages
12
Hi,
I have written a small application and hidden the commandbars with the following code (previously found on the web):

------------------------------------------------------------------------------------------------------------------
Public Function DisableCmdBars()

Dim cBars As CommandBars
Dim cBar As CommandBar

'reference your databases commandbars collection - References MS Office 11.
Set cBars = Application.CommandBars

'loop through each commandbar in the commandbars collection
For Each cBar In cBars
With cBar

' if it is a tool Bar, disable it
If .Type = 0 Then
.Enabled = False

'Uncomment the below lines if you want to disable the menu bar(s) too
ElseIf .Type = 1 Then

.Enabled = False

End If
End With

Next

'Pop-Up menus remain enabled

'disable the ability to customise the toolbars (unnecessary if you disable the menu bar)
cBars.DisableCustomize = True

Application.CommandBars("Print Preview").Enabled = True

End Function
------------------------------------------------------------------------------------------------------------------

This removes all menus O.K.

Now I want to enable just the 'Print Preview' menubar when running reports (with the design button disabled). I have tried many variations and searched the web but, still it does not work.

Any help would be most appreciated.
 

Users who are viewing this thread

Back
Top Bottom