Can I add code to a macro in MSP2010 so that it will not run after a specified date?

The code I have tried is this:

Dim expire As Date

expire = 1 / 8 / 2015

If activeproject.currentdate.value > expire Then
    MsgBox ("This macro is no longer accessible, please contact your PMO")
    Exit Sub
End If

'actual macro

End Sub

The intention is to protect my work once I have left an organisation.

  • Why would you want some business functionality to be unavailable after you have left?
    – Marv Mills
    Jul 1, 2015 at 14:54
  • These are a number of schedule checkers and reporting tools that I have been developing over time that I would not want clients to continue to access if my company was no longer engaged to provide planning support.
    – Ian
    Jul 1, 2015 at 15:13
  • Shouldn't you just uninstall them then?
    – Marv Mills
    Jul 1, 2015 at 15:29
  • I anticipate sharing several of the tools with members of the team to help them with their updating. Once they have been circulated I doubt I would be able to remove all installations.
    – Ian
    Jul 1, 2015 at 15:37
  • 1) What are the terms of your contract? Most contracts grant permanent rights to any code developed during the contract. (2) It seems trivial for the customer to override this code - are you doing eyewash security?
    – MCW
    Jul 1, 2015 at 17:00

1 Answer 1


I'm going to make an assumption that you don't have an agreement with the other party to have access to your IP. Generally anything developed by you on their time is theirs, but maybe these are macros you built yourself on your own time.

  1. Write a plugin. Your killswitch code will work, and it would be harder for them to just go in and comment it back out.
  2. Keep your code in project file on a shared drive, and access it from the other file by using:

    Application.Run "path/to/file.mpp!secret_code"
  3. Negotiate a royalty free runtime license for a couple bucks, (or even free) and use them as a reference for your next contract.

Breaking people's stuff isn't going to win you any friends, and depending on your jurisdiction this type of logic bomb may actually be illegal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.