Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CM CM is offline
external usenet poster
 
Posts: 136
Default reset hidden commandbars using workbook_beforeclose()

I am using workbook_open to hide commandbars. I am using workbook_beforeclose
to reset them.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Ply").Enabled = True
Application.CommandBars("Toolbar List").Enabled = True
End Sub

The problem is that when I choose to 'Cancel' out of closing the workbook,
the reset happens anyway and all of the command bars are visible. Pleas
advise on a solution.

cm
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default reset hidden commandbars using workbook_beforeclose()

I use application level events

so I have an xla that instantiates a class module where I have a variable
decalred WITHEVENTS as an excel appliction. The class has workbook close etc
events and I use this to control which command bars get shown or hidden

you can customise it for specific workbooks to hide all menu/command bars

"cm" wrote:

I am using workbook_open to hide commandbars. I am using workbook_beforeclose
to reset them.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Ply").Enabled = True
Application.CommandBars("Toolbar List").Enabled = True
End Sub

The problem is that when I choose to 'Cancel' out of closing the workbook,
the reset happens anyway and all of the command bars are visible. Pleas
advise on a solution.

cm

  #3   Report Post  
Posted to microsoft.public.excel.programming
CM CM is offline
external usenet poster
 
Posts: 136
Default reset hidden commandbars using workbook_beforeclose()

I'm sorry that is a bit beyond my current expertise level. I am pretty new to
vb. Is there anything a little less complex that you could suggest?

cm



"Patrick Molloy" wrote:

I use application level events

so I have an xla that instantiates a class module where I have a variable
decalred WITHEVENTS as an excel appliction. The class has workbook close etc
events and I use this to control which command bars get shown or hidden

you can customise it for specific workbooks to hide all menu/command bars

"cm" wrote:

I am using workbook_open to hide commandbars. I am using workbook_beforeclose
to reset them.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Ply").Enabled = True
Application.CommandBars("Toolbar List").Enabled = True
End Sub

The problem is that when I choose to 'Cancel' out of closing the workbook,
the reset happens anyway and all of the command bars are visible. Pleas
advise on a solution.

cm

  #4   Report Post  
Posted to microsoft.public.excel.programming
CM CM is offline
external usenet poster
 
Posts: 136
Default reset hidden commandbars using workbook_beforeclose()

I found a way in another post:

For saving and closing a workbook the best way is to use the
SaveChanges parameter of the Workbook.Close method:

ActiveWorkbook.Close SaveChanges:=True

You can also prevent certain prompts by using
Application.DisplayAlerts, e.g.

Application.DisplayAlerts = False

thanks for your help

"Patrick Molloy" wrote:

I use application level events

so I have an xla that instantiates a class module where I have a variable
decalred WITHEVENTS as an excel appliction. The class has workbook close etc
events and I use this to control which command bars get shown or hidden

you can customise it for specific workbooks to hide all menu/command bars

"cm" wrote:

I am using workbook_open to hide commandbars. I am using workbook_beforeclose
to reset them.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Ply").Enabled = True
Application.CommandBars("Toolbar List").Enabled = True
End Sub

The problem is that when I choose to 'Cancel' out of closing the workbook,
the reset happens anyway and all of the command bars are visible. Pleas
advise on a solution.

cm

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Workbook_BeforeClose Sandy Excel Programming 2 May 3rd 08 05:16 PM
Workbook_BeforeClose Sandy Excel Programming 0 May 3rd 08 12:04 PM
Rows hidden by Autofilter vs hidden by changing the Hidden property LEO@KCC Excel Programming 4 September 11th 07 10:14 AM
CommandBars vs CommandBars(1).Controls Sean Excel Programming 3 April 3rd 06 01:34 PM
Workbook_BeforeClose PO Excel Programming 2 January 30th 05 05:07 PM


All times are GMT +1. The time now is 05:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"