first time class module
I haven't seen this on Walkenbach, but this doesn't seem right.
I am assuming that the ABuse commandbar applies to a single workbook? If so,
why are you using application events which would apply to all workbooks? And
as it applies to all workbooks, why would you want to hide it when any, or
all, workbooks close.
I would have thought that you should have some code to build or make visible
the Abuse commandbar, and some code to hide it. If it applies to a single
workbook, the best places would be the workbook open and beforeclose
events.
--
HTH
RP
"davegb" wrote in message
oups.com...
I want to hide a toolbar called "Abuse" when the workbook closes. I
looked it up in Walkenbach and tried to modify the code I found there
for my purpose. It doesn't work, but it doesn't hang either. Surprising
that it doesn't hang up.
Here is the code from the Class Module "HideToolbar"
Public WithEvents AppEvents As Application
Private Sub appevents_beforeclose()
Application.CommandBars("Abuse").Visible = False
End Sub
Here is the code from "ThisWorkbook":
Private Sub BeforeClose()
Call Init
End Sub
Here's the code from the regular module:
Dim AppObject As New HideToolbar
Sub Init()
Set AppObject.AppEvents = Application
End Sub
Any ideas on why it doesn't hide the toolbar?
Thanks in advance.
|