Hi Alfredo
There are a few ways this can be done, here is one. In your add-in have a sheet who's Visible property is set to xlVeryHidden. Then in the Workbook module for the Add-in put some cde like this:
Private Sub Workbook_AddinInstall()
ThisWorkbook.Sheet2.Range("A1") = Date
End Sub
Private Sub Workbook_Open()
If ThisWorkbook.Sheet2.Range("A1") = Date - 30 Then
MsgBox "Sorry, the 30 day trial is over", vbOKOnly
AddIns("Your Addin Name").Installed = False
End If
End Sub
Dave
OzGrid Business Applications
Hi Dave:
Thank you for the code but, I don't seem to make it work the way it is intended. Maybe you can tell me the value I have to put in Sheet2("a1"). I tried today's date and compiled, Shifted Windows clock 30 days ahead and tried to load the addin. It Works. I tried one year ahead and still works. Thank you.
Sorry Alfredo, It's been a while since I've done this :O) Looks like I made a couple of mistakes. I shouldn't have used the sheets code name and missed an IF statement.
Private Sub Workbook_AddinInstall()
If ThisWorkbook.Sheets("Sheet2").Range("A1") = "" Then
ThisWorkbook.Sheets("Sheet2").Range("A1") = Date
End If
End Sub
Private Sub Workbook_Open()
If ThisWorkbook.Sheets("Sheet2") <> "" Then
If ThisWorkbook.Sheets("Sheet2") = Date - 30 Then
MsgBox "Sorry, the 30 day trial is over", vbOKOnly
AddIns("Your Addin Name").Installed = False
End If
End If
End Sub
Again this must be placed in the Workbook module of you Add-In. Once you have put the code in save and close your add-in and then install it. Unhide the sheet you use and make sure the date is in cell A1. Now close out of Excel and wind the clock forward > 30 days. Open Excel again and you should get the message.
Dave
OzGrid Business Applications
Thanks Dave, i had to modiff. it a little, but it's working now