D
davegb
GB said:So, what did you decide. Dropping this aspect of the project?
See my questions above. Haven't dropped it, still struggling.
I was going
GB said:So, what did you decide. Dropping this aspect of the project?
GB said:Ohh I think I understand your first question finally. All about Menubar.
Well, see this goes into the aspect of variable scope. See, I defined a
variable as MenuBar which yes is a Commandbar... Within the line that
creates the Commandbar, there is a "variable"/property name called Menubar
(Menubar:=false). Excel expects that here the use of Menubar:= is related to
a property of Commandbars, not the variable that I am setting the result.
Okay, so here probably a poor use of a variable name for understanding...
If not that, then yes, Menubar is a Toolbar. Any given toolbar, is a subset
of the Toolbars group... So you can talk about a single toolbar, or you can
talk about all toolbars. As for it being a property, I think that is an
incorrect usage of the word. It is more of an object of the Toolbars group.
(Say toolbars(10) or something.)
Hopefully that clarifies the other question that you asked.?!
The later part about calling all_bars_delete? Well, if when trying to hide
the toolbar(s) (Which is called from leaving the workbook, not the
worksheet.) the toolbar does not exist, then there is a strong possibility
that the other toolbars also do not exist. Also, if they do not exist when
hiding, then they will not exist when showing them either, so this "cleans"
up the toolbars to force them to be recreated when they are shown again later.
Get all those questions answered?
GB said:I did just try to close my workbook, I think for the first time since I
redesigned the code... It runs into a problem that is not yet handled.. My
fix for it was to revise the Thisworkbook code to read as follows:
Option Explicit
Dim Closing As Boolean
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ToolBars2.All_Bars_Delete
Closing = True
End Sub
Private Sub Workbook_Open()
ToolBars2.All_Bars
End Sub
Private Sub Workbook_WindowActivate(ByVal Wn As Window)
ToolBars2.All_Bars
End Sub
Private Sub Workbook_WindowDeactivate(ByVal Wn As Window)
If Closing = False Then
ToolBars2.All_Bars_Hide
End If
End Sub
On closing, two routines are run, the first is the close sub routine, the
second is the windowdeactivate.
I guess in my development I didn't handle what happens if you try to hide a
non-existent toolbar. The change above (usage of the Closing boolean
variable) prevents trying to hide a deleted toolbar.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.