Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
PFS PFS is offline
external usenet poster
 
Posts: 8
Default SaveAs closing file without firing event WorkBook_beforeclose

Hi,

I have a workbook which very-hides all of the sheets but one in the
BeforeSave and BeforeClose events.

So that if a user opens up the workbook without macros enabled all they
will see is the front page, nothing else. If they open it with macros
enabled and their password has been entered, it opens the rest of the
sheets. Got that working beautifully if you use Close or Save or even
in SaveAs in the newly created file.

I have found a loophole though, which I will try to explain.

When you have the original file (I will call this file A) and open it
up with macros enabled, enter a password, get into it and then, do a
"Save As" to File B.

Now I don't really understand what is happening but as Excel does the
"Save As", it goes through a process to close File A which doesn't seem
to invoke the WorkBook_BeforeClose event (which hides everything
again). So now we have File B open, and File A closed (by the SaveAs
command).

Consequently, you can close File B and then open File A, disable
macros, and then gain access to the whole spreadsheet because it hasn't
gone through a "normal" close procedure.

Any ideas on how to close this loophole

cheers

Paul

  #2   Report Post  
Posted to microsoft.public.excel.programming
PFS PFS is offline
external usenet poster
 
Posts: 8
Default SaveAs closing file without firing event WorkBook_beforeclose

ttt


PFS wrote:
Hi,

I have a workbook which very-hides all of the sheets but one in the
BeforeSave and BeforeClose events.

So that if a user opens up the workbook without macros enabled all they
will see is the front page, nothing else. If they open it with macros
enabled and their password has been entered, it opens the rest of the
sheets. Got that working beautifully if you use Close or Save or even
in SaveAs in the newly created file.

I have found a loophole though, which I will try to explain.

When you have the original file (I will call this file A) and open it
up with macros enabled, enter a password, get into it and then, do a
"Save As" to File B.

Now I don't really understand what is happening but as Excel does the
"Save As", it goes through a process to close File A which doesn't seem
to invoke the WorkBook_BeforeClose event (which hides everything
again). So now we have File B open, and File A closed (by the SaveAs
command).

Consequently, you can close File B and then open File A, disable
macros, and then gain access to the whole spreadsheet because it hasn't
gone through a "normal" close procedure.

Any ideas on how to close this loophole

cheers

Paul


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_Open event not firing 0013 Excel Programming 4 May 24th 05 09:53 PM
Excel closing event of a specific file m.ahrens Excel Programming 1 December 13th 04 08:54 PM
Workbook_BeforeClose Event Shatin Excel Programming 2 January 24th 04 03:50 AM
OnTime event not firing in Workbook_Open event procedure GingerTommy Excel Programming 0 September 24th 03 03:18 PM
VBA capture File SaveAs Event Linda Mcfarlane Excel Programming 2 September 17th 03 04:06 AM


All times are GMT +1. The time now is 06:54 PM.

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

About Us

"It's about Microsoft Excel"