Thread: [Solved] Students Cheating
View Single Post
 
Old 04-03-2014, 03:13 PM
fumei fumei is offline Windows 7 64bit Office XP
Expert
 
Join Date: Jan 2013
Posts: 440
fumei is on a distinguished road
Default

First of all, there is no definitive way to make anything to do with a Word document truly, fully, secure. Someone who really knows Word can find a way to get past just about anything.

That being said, yes checking the editing time is a good clue. However, "editing time" ONLY means the accumulated time in a single session the document is open. If you open a Word document and do nothing, just wait an hour, the "editing time" is increased by one hour. So if someone knew that, they could cheat your check of time by simply leaving the document open for an hour. And, as macropod pointed out, the new person would likely do a SaveAs, which resets it.

You could grab some data on who and when the document is opened and store them in document variables. Again, if someone really knows Word they could fudge this. However, document variables are NOT visible to normal Word use, unless you look for them. You could put the following in the Document_Open event (in the ThisDocument module).

Code:
Private Sub Document_Open()
Dim strUser As String
Dim aVar
Dim num As Long
strUser = Environ("username")
For Each aVar In ActiveDocument.Variables
   If aVar.Name = strUser Then num = aVar.Index
Next aVar
If num = 0 Then
   ActiveDocument.Variables.Add Name:=strUser, Value:=Now
Else
   ActiveDocument.Variables(num).Value = Now
End If
End Sub
This gets the user logon name - environ (username) - and gives that to a variable. then it checks to see if there is an existing document variable of that name. If there is, it changes its value to Now (current date and time). If there is not - i.e. this is a NEW user opening the document - a document variable is added: Name = username, Value = Now.

To read who and when opened the document:
Code:
Sub GetAllVariables()
Dim aVar
Dim strListVars As String
For Each aVar In ActiveDocument.Variables
  strListVars = strListVars & _
     aVar.Name & vbTab & aVar.Value & vbCrLf
Next
MsgBox strListVars
End Sub
This displays a messagebox with the name and date the document was opened.

AGAIN, though, it is a very very simple thing to open up the VBA editor, see the above code and...delete it. Boom. then delete any existing variables. Boom. Gone.

Can you "sort of" catch cheaters? Maybe. Can you catch a cheater who knows Word? Probably not.
Reply With Quote