Does anybody know how I can make a Demo version of an excel application using visual basic? I was thinking of using a date or counting the number of times the programme is started.
You can use registry "VB and VBA Settings" key. There are GetSetting function and SaveSetting statement (plus GetAllSettings) to simplify access to that section of registry. For instance:
[tt]Counter=GetSetting(appname:="YourDemoApp", section:="StartUp", Key:="Counter", Default:=0)
Counter=Counter+1
' close application if counter>limit
SaveSetting appname:="YourDemoApp", section:="StartUp", Key:="Counter", setting:=Counter[/tt]
Just use the same way, somewhere:
[tt]SaveSetting appname:="YourDemoApp", section:="StartUp", Key:="Counter", setting:=0[/tt]
You can use other keys in your application, as ...Key:="Demo", setting:=True etc.
You can find some help in VBA help file.
BTW, it is not the best way to protect application (and excel is not the best platform for creating well secured application), but enough for standard user with blocked access to the registry.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.