Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Expiration date on Macro


Just out of fun and curiosity, how would I create Excel VBA code for a
macro to stop from running after a certain number of days (e.g., after
30 days)?

I know it should be easily defeatable, but I wanted to learn.

Thanks! :)


--
Borg
------------------------------------------------------------------------
Borg's Profile: http://www.excelforum.com/member.php...o&userid=36396
View this thread: http://www.excelforum.com/showthread...hreadid=566866

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Expiration date on Macro


Hi in your Auto_Open sub type If Date = "YOUR DATE HERE" Then Call YOUR
SUB CONTAINING THE CODE BELOW, the code below is from Chip Pearsons site
there is a whole host of helpful things there take a look!
http://www.cpearson.com/excel.htm

Regards,
Simon

Deleting All VBA Code In A Project

The procedure below will delete all the VBA code in a project. You
should use this procedure with care, as it will permanently delete the
code. Standard modules, user forms, and class modules will be removed,
and code within the ThisWorkbook module and the sheet modules will be
deleted.

Sub DeleteAllVBA()
Dim VBComp As VBIDE.VBComponent
Dim VBComps As VBIDE.VBComponents

Set VBComps = ActiveWorkbook.VBProject.VBComponents

For Each VBComp In VBComps
Select Case VBComp.Type
Case vbext_ct_StdModule, vbext_ct_MSForm, _
vbext_ct_ClassModule
VBComps.Remove VBComp
Case Else
With VBComp.CodeModule
..DeleteLines 1, .CountOfLines
End With
End Select
Next VBComp

End Sub


--
Simon Lloyd
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708
View this thread: http://www.excelforum.com/showthread...hreadid=566866

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Expiration date on Macro


Hi.

Thanks, but I was looking for something that was not permanent. But, I
will look at it for learning purposes. :)

I just wanted a code which will not execute the rest of the macro code,
after the expiration date. (To stop those pesky co-worker friends from
releasing some of my beta files.) I still wanted to be able to modify
the code to delete the expiration date later. Thanks!


--
Borg
------------------------------------------------------------------------
Borg's Profile: http://www.excelforum.com/member.php...o&userid=36396
View this thread: http://www.excelforum.com/showthread...hreadid=566866

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default Expiration date on Macro

Borg, maybe something like this,

Private Sub Workbook_Open()
With ActiveWorkbook
If Date DateValue("07-31-2006") Then
MsgBox "You Can Not Use This Any More"
Exit Sub
End If
MsgBox "You Can Use This"

End With

End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Borg" wrote in message
...

Hi.

Thanks, but I was looking for something that was not permanent. But, I
will look at it for learning purposes. :)

I just wanted a code which will not execute the rest of the macro code,
after the expiration date. (To stop those pesky co-worker friends from
releasing some of my beta files.) I still wanted to be able to modify
the code to delete the expiration date later. Thanks!


--
Borg
------------------------------------------------------------------------
Borg's Profile:

http://www.excelforum.com/member.php...o&userid=36396
View this thread: http://www.excelforum.com/showthread...hreadid=566866



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Expiration date on Macro


Thanks to both of you. Now I have two options. :)


--
Borg
------------------------------------------------------------------------
Borg's Profile: http://www.excelforum.com/member.php...o&userid=36396
View this thread: http://www.excelforum.com/showthread...hreadid=566866

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
encrypting MS document with expiration date Peter A[_2_] Excel Discussion (Misc queries) 1 June 18th 09 03:42 PM
Calculat an expiration date old coach Excel Worksheet Functions 0 February 23rd 09 03:55 AM
Expiration Date countdown Colin Hayes Excel Worksheet Functions 3 January 15th 09 01:23 PM
color code a row by expiration date? kate Excel Worksheet Functions 6 August 15th 06 08:14 AM
Code For Expiration Date Juan[_3_] Excel Programming 2 October 25th 03 09:15 AM


All times are GMT +1. The time now is 01:55 AM.

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"