ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need VBA code to make app expire after period of time (https://www.excelbanter.com/excel-programming/432644-need-vba-code-make-app-expire-after-period-time.html)

TJ[_6_]

Need VBA code to make app expire after period of time
 
Can someone provide some sample code or reference to make an
application expire after a period of time.

Thanks.

NDBC

Need VBA code to make app expire after period of time
 
At the start of the sub put something like

If Now() "date and time" Then
Exit Sub

Else

'the rest of you sub goes here as normal.

My only concern is I'm not sure how to put in the date and time that you
want finish at. Another alternative is to put the date time in cell AA1

If Now() Sheets("Sheet1").Range("AA1") Then
Exit Sub

Else

'the rest of you sub goes here as normal.


Hope this helps you get on track anyway.

"TJ" wrote:

Can someone provide some sample code or reference to make an
application expire after a period of time.

Thanks.


NDBC

Need VBA code to make app expire after period of time
 
I just tried this and it worked

If Now() "20/08/2009 3:32pm" Then

but

If Now() "20/08/2009 15:32" Then

didn't work.



"NDBC" wrote:

At the start of the sub put something like

If Now() "date and time" Then
Exit Sub

Else

'the rest of you sub goes here as normal.

My only concern is I'm not sure how to put in the date and time that you
want finish at. Another alternative is to put the date time in cell AA1

If Now() Sheets("Sheet1").Range("AA1") Then
Exit Sub

Else

'the rest of you sub goes here as normal.


Hope this helps you get on track anyway.

"TJ" wrote:

Can someone provide some sample code or reference to make an
application expire after a period of time.

Thanks.


Chip Pearson

Need VBA code to make app expire after period of time
 
See http://www.cpearson.com/excel/WorkbookTimeBomb.aspx for example
code.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)




On Wed, 19 Aug 2009 19:21:39 -0700 (PDT), TJ
wrote:

Can someone provide some sample code or reference to make an
application expire after a period of time.

Thanks.


Dave Peterson

Need VBA code to make app expire after period of time
 
Visit Chip Pearson's site:
http://www.cpearson.com/Excel/WorkbookTimeBomb.aspx

TJ wrote:

Can someone provide some sample code or reference to make an
application expire after a period of time.

Thanks.


--

Dave Peterson

Phil Hibbs

Need VBA code to make app expire after period of time
 
NDBC wrote:
I just tried this and it worked
If Now() "20/08/2009 3:32pm" Then
but
If Now() "20/08/2009 15:32" Then
didn't work.


What's going on there? Is it converting Now() to a string using the
user's locale, and then comparing it to your hard-coded string in your
locale? Or does the string get converted to a Date value and then
compared? I think you need to protect your code from locality issues
by explicitly formatting the date and comparing, e.g.

If Format(Now(), "yyyy-mm-dd") = "2009-08-20" Then

Phil Hibbs.

TJ[_6_]

Need VBA code to make app expire after period of time
 
On Aug 20, 9:01*am, Chip Pearson wrote:
Seehttp://www.cpearson.com/excel/WorkbookTimeBomb.aspxfor example
code.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
* * Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLCwww.cpearson.com
(email on web site)

On Wed, 19 Aug 2009 19:21:39 -0700 (PDT), TJ
wrote:



Can someone provide some sample code or reference to make an
application expire after a period of time.


Thanks.- Hide quoted text -


- Show quoted text -


Thank, Chip. Much appreciated.


All times are GMT +1. The time now is 07:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com