A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Is there a way to insert a formula, password or macro in an excel spreadsheet that will automatically delete the spreadsheet?



 
 
Thread Tools Display Modes
  #1  
Old February 8th, 2005, 07:42 AM
oil_driller
external usenet poster
 
Posts: n/a
Default Is there a way to insert a formula, password or macro in an excel spreadsheet that will automatically delete the spreadsheet?

Is there a way to insert a formula, password or macro in an excel
spreadsheet that will automatically delete the spreadsheet at the date you
specified?

thanks,

Charlie


  #2  
Old February 8th, 2005, 09:34 AM
Ron de Bruin
external usenet poster
 
Posts: n/a
Default

Hi Charlie

Delete the file is I think not a good idea?
Maybe the user have some information in it???
But it is possible, post back if you want to know how to do it

There is always a way to use your workbook if anybody wants it.
VBA is not save.

Put this in the workbook open event of the workbook.
After the date the file will be closed when you open it.

Private Sub Workbook_Open()
If Date DateSerial(2005, 4, 1) Then
ThisWorkbook.Close savechanges:=False
End If
End Sub

But macro's will not run when holding the shift key or disable macro's
So closing with a macro is not save.

Try the code above in combination with this

A good way is to hide all sheets except one and unhide them in
the workbook open event.
Place a message on that sheet with "you must enabled macro's to work with this file"
And hide the sheets in the beforeclose event.
So the user can't use the workbook if he disable macro's.
If he do the workbook open event don't run so there are no sheets
to work with
You must protect your project also in the VBA editor because a user can't unhide
the sheets there also if you don't do that

Some example code to do this
Sheet 1 stay always visible

Sub HidealmostAll()
Dim a As Integer
For a = 2 To Sheets.Count
Sheets(a).Visible = xlVeryHidden
Next a
End Sub

Sub ShowAll()
Dim a As Integer
For a = 2 To Sheets.Count
Sheets(a).Visible = True
Next a
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



"oil_driller" wrote in message ...
Is there a way to insert a formula, password or macro in an excel spreadsheet that will automatically delete the spreadsheet at
the date you specified?

thanks,

Charlie



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
After Query can a macro Open Excel and a spreadsheet file Adam General Discussion 5 January 24th, 2005 05:37 PM
Windows in Taskbar Chevy General Discussion 8 October 15th, 2004 03:57 PM
Excel 2000 converts UNC links to relative - need to preserve UNC links! Jeff Adams Links and Linking 3 April 15th, 2004 05:46 PM
Changing dsn connection information (Password) Mike N Worksheet Functions 2 December 3rd, 2003 08:04 PM


All times are GMT +1. The time now is 12:40 AM.


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