mikeloria

Resetting Processbook After hiding the toolbars

Discussion created by mikeloria on Apr 7, 2011
Latest reply on Apr 11, 2011 by spilon

I run the display_open VBA code that is listed below when I open processbook displays that I want to be read only and are meant for operators who do not need to change anything. This works out great but then the processbook will retain the hidden menu bars on the next time that processbook is opened, even if I just open processbook with no display. I am looking for a clean way around this. I tried the following listed in the Display_BeforeClose event but I get a bunch of duplicated menu bars which is pretty ugly:

 

1) Is there something that can be done in the ini or a better solution when closing one of these displays? The ini file seemed to be the best approach if possibly.

 

2) I also have one other issue, I would like to also close the browser and playback menu bars. They do not close as part of the  Application.CommandBars.Item(i).Visible = False loop. Is there a solution for that?

 

3) and one more (sorry) for the main menu bar (file edit view ....), is there a way to keep just that one open and close everything else? Maybe I can close everything and reopen just the main menu bar but I do not know how to reference it.

 

Thank you so much for your help on this....

 
//code ran when display is clsoed that is not working to well

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Private Sub Display_BeforeClose(bCancelDefault As Boolean)
For i = 1 To Application.CommandBars.Count
' need to fix this!!! it makes several menu bars duplicated!!!!!!
    Application.CommandBars.Item(i).Visible = True
 Next i
End Sub

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//code ran when display is opened

Private Sub Display_Open()

Application.Maximize
ThisDisplay.Maximize

For i = 1 To Application.CommandBars.Count
    Application.CommandBars.Item(i).Visible = False
 Next i
 
 Application.Refresh
Me.Zoom = "FitAll"

'set it runmode
If Not Application.RunMode Then
Application.RunMode = True
End If

End Sub

 

Outcomes