Prevent Users Manipulating Time Out on Excel

sabbuck

New Member
Joined
Aug 21, 2017
Messages
24
Hi All,

I have a form on excel which is being used on a trial basis. Once the trial is up a message box appears to inform the user their trial has expired. If the expiry date in the code is 31/08/17 it should expire as today's date is 15/09/17...which it does. But I've realized if I manually change the date on my computer to say 29/08/17 then the code doesn't recognize today's actual date, it will only recognize the date I have set my computer to. Is there a way to prevent this? I don't want users being able to access this form after their trial has expired. The code I'm currently using is:

Code:
'Dim Edate As DateEdate = Format("30/09/2017", "DD/MM/YYYY")
If Date > Edate Then
MsgBox ("CURMIS Investment Register template was valid up to " & Format(Edate, "dd-mmm-yyyy") & " and will close.") & vbNewLine & " " & vbNewLine & "Please Contact Michael O'Grady & Co. for further use of this tool."
ActiveWorkbook.Close savechanges:=False'
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
hi Sabbuck,

Apologies for not providing a better steer, but the steps I'd take would be to access a remote time server to retrieve the time - provided the computer is connected to the internet I would expect it to work. I found more detail here: http://www.myengineeringworld.net/2013/09/retrieve-time-from-internet-server-vba.html but haven't had a chance to check it.

The alternative is to recognise that people are basically lazy and won't think to change the computer clock until after the event. Thus you could use the normal NOW() function and then use xlVeryHidden to hide the sheet in a way that normal users can't unhide. The code for this would be something like:

Code:
worksheets("Trial Sheet").visible=xlVeryHidden

you can unhide the sheet either programmatically by setting the visible property to 'True' or via the sheet properties in the VBE.

Final thought - make sure your code is password protected.

Hope this helps.

Regards

Peter
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top