PDA

View Full Version : Solved: Determine if file is run remotely?



aerodoc
10-11-2011, 06:53 PM
I have no locking schemes for my files. While I investigated a few solutions, they were too cumbersome.

That said, my approach is to distribute the unlocked file to the company, without any protection from unauthorized distribution. I will offer the company a trial version, but they must delete the file after a certain amount of time.

Is there any way to determine if they launch the file after the allowable time limit?

Stargazer
10-12-2011, 12:54 AM
My initial thoughts would be to hide allt he worksheets on workbook close, leaving only a placeholder sheet with a message saying, "You must enable macros to view this workbook" on it.

So when someone opens the workbook, this is all they get until they enable macros.

In Workbook.Open, put something like If Cell in Veryhidden worksheet is blank, then write Now, otherwise if Now > 3Days from value in Cell, then show amessage box and then workbook.close, false.

That should do the job. Easy to code as well.

Rob.

Rob342
10-12-2011, 04:47 AM
see this KB article

http://www.vbaexpress.com/kb/getarticle.php?kb_id=475

aerodoc
10-12-2011, 09:24 AM
Thanks!

Both ways will work. In my case, I just need a hard date so I can do with simply with comparing the DATE or NOW variable with the current time.

But the article by Rob is great because it starts the trial once the user opens it. Either way, these are both good options.

justdriving
10-12-2011, 11:41 AM
Hi,

I tried kb given above. I got following error: -

Path/File access error (Error 75)

at following line: -

Open ObscurePath & ObscureFile For Output As #1


How can I resolve this?

Rob342
10-12-2011, 12:41 PM
make sure this is valid

Const ObscurePath$ = "C:\Program Files\MyFiles\"
Const ObscureFile$ = "MyName_DLL"

NB I put the underscore so that anybody wont be looking for a DLL file to mess with.

justdriving
10-12-2011, 01:18 PM
Should I add any Reference in VBE?

shrivallabha
10-13-2011, 10:50 AM
The thread is "SOLVED" but perhaps, it will be useful if someone came in searching for another alternative. Probably, it is simpler:
http://j-walk.com/ss/excel/tips/tip60.htm