Read and write and a registry value with Excel VBA RRS feed

  • Question

  • I want to deploy my Excel add in with a Trial period. I heard it was better to create a registry value specifying the date of installation. So that I could read the value to check validity. I have a 32 bit Visual Basic editor operating in 64 bit OS (windows 10). I tried many code available online but could neither create a entry in HLM\Software or nor read any. It would be grateful if someone could give me a sample code which would allow me to use it for 32 bit as well as 64 bit version of office operating in 32 bit or 64 bit operating in both 32 bit OS and 64 bit OS and . Also I am interested to know is there any other better way to deploy an excel addin with trial version? Thank you.

    Arun N

    Friday, April 21, 2017 3:44 PM

All replies

  • You can write/read registry using GetSetting & SaveSetting

    GetSetting(appname:="MyAppName", section:="TrialPeriod", key:="EncryptedDateKey")
    SaveSetting appname:="MyAppName", section:="TrialPeriod", key:="EncryptedDateKey", setting:="azsrted12"

    You'll need to encrypt trial period key or user could simply change it manually.  It saves it to:

    HKEY_CURRENT_USER\Software\VB and VBA Program Settings. You could use something like this ($$) to deploy app.

    Friday, April 21, 2017 6:19 PM