ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Menu gone, what am I doing wrong? (https://www.excelbanter.com/excel-programming/382015-menu-gone-what-am-i-doing-wrong.html)

Kev

Menu gone, what am I doing wrong?
 
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
--

Thanks
....Kev...
....kev...

Doug Glancy

Menu gone, what am I doing wrong?
 
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

"kev" wrote in message
...
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
--

Thanks
...Kev...
...kev...




Doug Glancy

Menu gone, what am I doing wrong?
 
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

"Doug Glancy" wrote in message
...
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

"kev" wrote in message
...
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
--

Thanks
...Kev...
...kev...






Kev

Menu gone, what am I doing wrong?
 
Works Great!
Thanks,
This is why I come to all you Pro's.

--
....kev...


"Doug Glancy" wrote:

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

"Doug Glancy" wrote in message
...
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

"kev" wrote in message
...
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
--

Thanks
...Kev...
...kev...








All times are GMT +1. The time now is 02:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com