Can you elaborate which are the toolbars that are duplicated? I've tried out your code and there is an instant that a number of menu bars appears at the same time, but disappearing in the next split second. The reason is probably because there are a few different menu bars available, and only 1 should be active, hence the other menu bar auto-hide themselves. Other than that it seems to work fine for me.
To answer your questions
- I am not aware of any configurations in the ini file for this. Let's see what others on the community have to say about this.
- The browser and playback bars are actually part of a docking window instead of toolbars, so to hide it, it would be something like:
Dim iDockWindows As Integer
For iDockWindows = 1 To Me.Application.DockWindows.Count
Dim oDockWindow As PBDockWindow
Set oDockWindow = Me.Application.DockWindows.Item(iDockWindows)
If oDockWindow.Title = "Toolbar Manager" Then
oDockWindow.Visible = False
- Again there are a few menu bars, you can reference to, here's how to leave the default menu bar on:
For i = 1 To Application.CommandBars.Count
If Application.CommandBars.Item(i).Name = "Default Menu Bar" Then
Application.CommandBars.Item(i).Visible = True
Application.CommandBars.Item(i).Visible = False
The other menu bars that you can use are Book Menu Bar, Display Menu Bar, View-Only Book Menu Bar and View-Only Display Menu Bar
It is the Default menu bar (the menu bar that has File Edit view ....) at the very top that gets duplicated. I have seen this behavior on at least 2 different machines running 126.96.36.199. It looks like that for every command bar that is made visible again, the default menu bar is duplicated. When you tried this, was the default menu bar hidden? It has been pretty repeatable for me.
An ini solution if it is possible I feel would be interesting and robust solution. Hiding these command bars with the addition of using the fit all is extremely powerful in providing the best presentation in many cases where editing is not needed or is desired.
The reason there are 3 "default" menu bars is dependent on what file you have open. If you've opened a PIW file, the "Book Menu Bar" will be displayed. If a PDI file is opened, then the "Display Menu Bar" will be displayed. If no file is opened then "Default".
Also, there is an INI setting to put ProcessBook in a "read-only" mode.
Inserting ProcessBook=PRIMARY under the [StartUp] section in the procbook.ini allows users on a network to view ProcessBooks, but not change them. The user will have access to the Standard Toolbar, including trend displays, but cannot save an ad hoc display.
Using this setting along with your VBA code with additional conditions to only show or hide the Display Menu Bar should give you what you're looking for.
Just a thought here... wouldn't it be appropriate to look into PI ActiveView (which is meant for that kind of read-only use) rather than using the fully-featured PI ProcessBook and cripple it down with code?