Menu gone, what am I doing wrong?

K

kev

Hi once again,
This code works good save for one problem. When I exit Excel, my menu's
don't return.
As you see I have tried both the "Deactivate" and the "Close" events but I'm
missing something. (All of these are in the workbook part).

Private Sub workbook_open()

Sheets("Sign").Select

End Sub

Private Sub Workbook_Activate()
Application.CommandBars("Worksheet Menu Bar").Enabled = False
End Sub
Private Sub Workbook_Deactivate()
Application.CommandBars("Worksheet Menu Bar").Enabled = True
End Sub
Private Sub Workbook_Close()
Application.CommandBars("Worksheet Menu Bar").Enabled = True
End Sub
 
D

Doug Glancy

Kev,

As you are showing them, these are not the actual Workbook events. In the
VBE ThisWorkbook module click on the dropdown menu at the top left and
choose Workbook. In the dropdown menu at the top right, choose
Workbook_BeforeClose, WorkBook_Deactivate, etc. Then put your code into
those modules.

Be aware that after the WorkBook_BeforeClose event runs, if there were
changes to the workbook, the user can cancel the close at the "Save
Changes?" prompt, so you the Workbook_Deactivate event is probably
preferable.

hth,

Doug
 
D

Doug Glancy

Kev,

I should have said that Workbook_Close is not a workbook event. The others
are correctly named, but I would still try creating them as described in my
previous post

hth,

Doug
 

Ask a Question

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.

Ask a Question

Similar Threads


Top