Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Workbook.Save triggers event Workbook_BeforeSave and things don't work!

I catch the event Workbook_BeforeSave and do a number of things, and
that works fine.

But when a VB subroutine calls Workbook.Save or Workbook.SaveAs, which
of course triggers the Workbook_BeforeSave event, a number of things in
the BeforeSave sub just don't work. The list includes:
* Worksheet.Unprotect / Worksheet.Protect
'*Application.Iteration = True/False
'*Application.ScreenUpdating = True/False
'*Application.Goto / Range.Select
'*Application.StatusBar = ...

Does anybody have any clues as to why? How about a work-around?

(Excel 2003)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 301
Default Workbook.Save triggers event Workbook_BeforeSave and things don't work!

You can set a global variable to true before the Save, and test it in the
Event procedu

ImSaving = True
ActiveWorkbook.Save
ImSaving = False
....
....
In the BeforeSave event:

If ImSaving Then Exit Sub
....
....
Bob Umlas
Excel MVP


"Dean Meyer" wrote in message
ps.com...
I catch the event Workbook_BeforeSave and do a number of things, and
that works fine.

But when a VB subroutine calls Workbook.Save or Workbook.SaveAs, which
of course triggers the Workbook_BeforeSave event, a number of things in
the BeforeSave sub just don't work. The list includes:
* Worksheet.Unprotect / Worksheet.Protect
'*Application.Iteration = True/False
'*Application.ScreenUpdating = True/False
'*Application.Goto / Range.Select
'*Application.StatusBar = ...

Does anybody have any clues as to why? How about a work-around?

(Excel 2003)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Workbook.Save triggers event Workbook_BeforeSave and things don't work!

Thanks, Bob. But I WANT the BeforeSave event code to run, not just
skip it!

Does anyone have any idea why so much VB code fails when a BeforeSave
event is triggered by a Workbook.Save rather than by the user?

--Dean



Bob Umlas wrote:
You can set a global variable to true before the Save, and test it in the
Event procedu

ImSaving = True
ActiveWorkbook.Save
ImSaving = False
...
...
In the BeforeSave event:

If ImSaving Then Exit Sub
...
...
Bob Umlas
Excel MVP


"Dean Meyer" wrote in message
ps.com...
I catch the event Workbook_BeforeSave and do a number of things, and
that works fine.

But when a VB subroutine calls Workbook.Save or Workbook.SaveAs, which
of course triggers the Workbook_BeforeSave event, a number of things in
the BeforeSave sub just don't work. The list includes:
* Worksheet.Unprotect / Worksheet.Protect
'*Application.Iteration = True/False
'*Application.ScreenUpdating = True/False
'*Application.Goto / Range.Select
'*Application.StatusBar = ...

Does anybody have any clues as to why? How about a work-around?

(Excel 2003)


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_BeforeSave Event Baapi[_21_] Excel Programming 4 July 4th 06 08:54 PM
No screen updating in Workbook_BeforeSave event after ActiveWorkbook.Save bmeijers Excel Programming 0 November 29th 05 01:51 PM
Event Triggers MVM Excel Programming 2 August 31st 05 03:29 PM
Problem with Workbook_BeforeSave event [email protected] Excel Programming 0 August 25th 05 10:49 PM
"Save As" triggers combo_change event mangesh_yadav[_154_] Excel Programming 0 November 5th 04 05:21 AM


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