Excel Add In - Limited Use?

  • Thread starter Thread starter sirin
  • Start date Start date
S

sirin

Jerry,
You are right. I only want the code such a way that outside the dat
range it will not perform any action. Iwill putup a msgbox saying tha
the date is passed away and now code will not work. All the users ar
our employees only at different offices and they can easily call me i
required. But I dont want to delete anything on any other users pc.

Hope someone can offer nice solution woth example code or atleast fe
pointers that help me acheive it.

Regards,
 
try like


Option Explicit

Private Sub Workbook_Open()
Const dtExpire As Date = #10/15/2004#
Dim ai As AddIn
Dim wbTmp As Workbook
If Date > dtExpire Then
MsgBox "Expired", vbCritical
If Me.IsAddin Then
For Each ai In AddIns
If ai.Name = Me.Name Then
If ai.Installed Then ai.Installed = False
Exit For
End If
Next
End If
Me.Close
End If
End Sub




keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 
Instead of a popup, which would require code, put your message on the
page that the workbook opens to (possibly with all other pages hidden)
then use the the code to restore the working environment, as well as
actually doing the work. Follow the link that Bob Phillips suggested
for eithder "Deleting A Procedure From A Module", "Deleting A Module
From A Workbook", "Deleting All Code From A Module", or "Deleting All
VBA Code In A Project" to remove/deactivate your code when outside the
date range.

To check on the date, use something like

If Date > DateValue("10/30/2004") Then
' fail
Else
' work
EndIf

Jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top