• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 415
  • Last Modified:

how do i block macro excel after 3 months in the code?

i wrote a macro in excel and i would like that after 3 months it will not be able to run any more until i will put new pass, how do i do that?

thanks
gvilbis
0
gvilbis
Asked:
gvilbis
  • 3
  • 2
4 Solutions
 
duncanb7Commented:
Could you do it by putting password on macro ?
take a look at this about protect macro on Excel
http://www.excel-easy.com/vba/examples/protect-macro.html

Duncan
0
 
duncanb7Commented:
OR you can set expire date for the macro on VBA
the following code is reference only.

You can put it the "ThisWorkbook" in the workbook
When you open new workbook and press atl-F11, it will
show a few sheets such sheet1(Sheet1),Sheet2(Sheet2),Sheet3(Sheet3) and "ThisWorkbook".
The macra will run first in proiority in the "ThisWorkbook" when
the workbook opens
Hope undrestand your question completely.If not , please point it out.

Duncan
Sub AutoOpen()
ExpirationCode
End Sub
Sub ExpirationCode()
Dim ExpirationDate As Date
ExpirationDate = DateSerial(2014, 10, 11)
If Now() >= ExpirationDate Then
MsgBox “Trial Period ended on ” & CStr(ExpirationDate) & “.”
ThisWorkbook.Close savechanges:=False
End If
End Sub

Open in new window

0
 
Naresh PatelTraderCommented:
I don't write code but my logic says.
A Macro password protected as mention by Mr.Duncan
B Need a code line which match date with todays date i.e. =TODAY() if it is after prescribed date then Don't execute.

Drawback - any one can fool this by changing system date ;(

Thanks
0
 
Naresh PatelTraderCommented:
ooppps sorry seen post after posting.
0
 
duncanb7Commented:
Thanks for your points

Have a nice day

Duncan
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now