Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default before save event

?Hi,

I have some code in the before save event. Its very simple, it only
hides the worksheets prior to a save.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)

Dim wSheet As Variant

Worksheets("menu").Activate

'hide other ThisWorkbook.worksheets
For Each wSheet In ThisWorkbook.Worksheets

If (wSheet.Name < "BLANK") Then wSheet.Visible = xlSheetVeryHidden

Next wSheet

End Sub

This code works perfectly every time if I run it from a save from the
toolbar or if I close the workbook down.

What it doesnt do, is where my problem lays. If I call thisworkbook.save
from VBA, the event fires and it runs through the code, but it doesnt action
anything.

The sheets dont hide, even though the code is running.


Can any one help?


Regards



Anthony

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 168
Default before save event

On Dec 26, 8:00*am, "Anthony" wrote:
?Hi,

* * I have some code in the before save event. Its very simple, it only
hides the worksheets prior to a save.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)

Dim wSheet As Variant

Worksheets("menu").Activate

'hide other ThisWorkbook.worksheets
For Each wSheet In ThisWorkbook.Worksheets

* * If (wSheet.Name < "BLANK") Then wSheet.Visible = xlSheetVeryHidden

Next wSheet

End Sub

This code works perfectly every time if I run it from a save from the
toolbar or if I close the workbook down.

What it doesnt do, is where my problem lays. If I call thisworkbook.save
from VBA, the event fires and it runs through the code, but it doesnt action
anything.

The sheets dont hide, even though the code is running.

Can any one help?

Regards

Anthony


Try putting your code in a regular module instead of a workbook event.
Then call from the workbook event or some other way such as a shape or
button....
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default before save event

?"Don Guillett Excel MVP" wrote in message
...

On Dec 26, 8:00 am, "Anthony" wrote:
?Hi,

I have some code in the before save event. Its very simple, it only
hides the worksheets prior to a save.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)

Dim wSheet As Variant

Worksheets("menu").Activate

'hide other ThisWorkbook.worksheets
For Each wSheet In ThisWorkbook.Worksheets

If (wSheet.Name < "BLANK") Then wSheet.Visible = xlSheetVeryHidden

Next wSheet

End Sub

This code works perfectly every time if I run it from a save from the
toolbar or if I close the workbook down.

What it doesnt do, is where my problem lays. If I call thisworkbook.save
from VBA, the event fires and it runs through the code, but it doesnt
action
anything.

The sheets dont hide, even though the code is running.

Can any one help?

Regards

Anthony


Try putting your code in a regular module instead of a workbook event.
Then call from the workbook event or some other way such as a shape or
button....


Hi,

Thank you for your response. I have ended up doing it the way you have
suggested and it works perfectly. (call module not the event)

Just a shame, the events there but is basically useless.

Regards

Anthony

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
Save Copies of Workbook with Before Save Event RyanH Excel Programming 1 October 27th 08 03:13 PM
Save As Event Sandy Excel Programming 3 April 28th 06 06:49 PM
Example After Save Event Steph[_6_] Excel Programming 4 October 27th 05 01:42 AM
After Save Event help Steph[_3_] Excel Programming 2 June 27th 05 07:00 PM
After save event Bart[_3_] Excel Programming 2 July 22nd 03 12:07 PM


All times are GMT +1. The time now is 09:06 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"