| View previous topic :: View next topic |
| Author |
Message |
Mahogan General User

Joined: 20 May 2009 Posts: 28
|
Posted: Wed Mar 16, 2011 6:12 pm Post subject: How to Make OOo Calc with an Expire Date? |
|
|
My goal to make a spreadsheet expire after a certain date, say 30 days, and have a user enter a password to be able to open it after that date. Then have it reset to another 30 days and require a new password for the next expiration date and so on. This may not be possible, however, I did find that you can set a sheet to expire in Excel.
See below:
Type the code that makes the spreadsheet expire into the code box provided. A proper code format that provides users with a message regarding the expiration date and the number of days left until the spreadsheet expires looks like this:
Sub Auto_Open()\ Dim exdate As Date \ exdate = "12/01/10" \ If Date > exdate Then \ MsgBox ("Spreadsheet has Expired") \ ActiveWorkbook.Close \ End If \ MsgBox ("Workbook Valid Until" & exdate - Date & "Days left") \ End Sub
Enter the date that the spreadsheet should expire by "exdate=" and any message you prefer regarding the expired worksheet in the place of "Spreadsheet has Expired."
Here is the full context:
http://www.ehow.com/how_5916660_make-excel-spreadsheet-expire.html
Does anyone know how to get this to work in OOo Calc?
Any help is appreciated. |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Thu Mar 17, 2011 4:25 am Post subject: |
|
|
All I know is how to bypass auto-open in Excel and Calc. _________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
Mahogan General User

Joined: 20 May 2009 Posts: 28
|
Posted: Thu Mar 17, 2011 7:39 am Post subject: Similar Post |
|
|
I see a similar post to make formulas obscure after a certain date.
http://www.oooforum.org/forum/viewtopic.phtml?t=74795&highlight=expire
However, I do not understand how to use it properly, I keep getting error 508 or Name?
where you have <your_calculation> do you reference the cell that you want the NA or do you actually put in the formula? I have tried both and neither work. |
|
| Back to top |
|
 |
JohnV Administrator

Joined: 07 Mar 2003 Posts: 8983 Location: Lexinton, Kentucky, USA
|
Posted: Thu Mar 17, 2011 9:09 am Post subject: |
|
|
You can put this macro in the document then use Tools > Customize > Events tab to tie it to the "Open Document" event.
| Code: |
Sub Expire
Dim d as Date
d = "3/20/11"
If Date > d then
MsgBox "Expired after " & d & "!"
ThisComponent.Dispose
Else MsgBox "Expires after " & d & "."
EndIf
End Sub |
|
|
| Back to top |
|
 |
Mahogan General User

Joined: 20 May 2009 Posts: 28
|
Posted: Thu Mar 17, 2011 10:34 am Post subject: This is a good step forward. |
|
|
| Thanks JohnV, that does work quite well for the initial 30 days expire time. Now the next challenge is how to get it to ask for a unique password that would at the same time reset the expire date to an additional 30 days and so on... |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Thu Mar 17, 2011 11:17 am Post subject: |
|
|
This is not a stand-up coder competition. You are not able to apply simple spreadsheet formulas while begging others to write program for you with constantly changing requirements. _________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
Mahogan General User

Joined: 20 May 2009 Posts: 28
|
Posted: Thu Mar 17, 2011 11:46 am Post subject: Courtesty requested. |
|
|
Villeroy that is quite an attack! Too bad you feel that way.
As my post initially read | Quote: | | My goal to make a spreadsheet expire after a certain date, say 30 days, and have a user enter a password to be able to open it after that date. Then have it reset to another 30 days and require a new password for the next expiration date and so on. This may not be possible... |
No where am I constantly changing requirements, nor begging! Perhaps you misunderstood.
While admittedly I am no Super User, I thought the main reason for a User Forum is to Help Others and hopefully in a courteous manner, perhaps I misunderstand? |
|
| Back to top |
|
 |
|