3 of 3 people found this helpful
There is no out-of-the-box functionality for this, but you could implement a rudimentary audit system yourself using VBA. For example, in each entry/display that you want audited, you can put in your VBA code in the AfterSave subroutine:
Private Sub Display_AfterSave()
'Do audit here
An example could be to use Environ$("Username") to get the user info, then save that along with the time and date to an external file. This way, if multiple users share this display, you would have a record of who made changes and when they made those changes. You could also make a simple backup system to periodically backup the displays so that if you need to rollback a particular change, you just find the time of change in your audit log, then restore the version prior to that.
I was handling this as a tech support case in parallel, and I thought I'd post the example display that I made.
NOTE: In order to use the display, you'll need to change the userform save code to point to a text file that exists on your machine (NameFile = <file path>). It's hard coded to point to my file.
It has VBA in the Display_AfterSave() code that opens a custom userform.
Private Sub Display_AfterSave() Call UserForm1.Show UserForm1.TextBox1.Text = "" End Sub
The userform then prompts the user for a comment.
Hitting save on the userform writes the display name, the username, the current date and time, and the reason for the change to a text file.
The reason the display name is written is so that all display entries can be audited together in one text file.
Private Sub CommandButton1_Click() Dim NameFile As String On Error GoTo Err_OpenExportFrm 'Open file for output NameFile = "C:\Users\AndMorty\Desktop\ChangeTracker.txt" Open NameFile For Append As #1 Print #1, ThisDisplay.Path & " was saved by " & Environ$("username") & " at " & Date & " " & Time() Print #1, "Reason: " & UserForm1.TextBox1.Text 'Close output file and exit Close #1 Call UserForm1.Hide Exit Sub Err_OpenExportFrm: Call MsgBox("Error while saving to audit file", vbCritical, "ERROR") 'Try closing the file anyways, to avoid it being locked Close #1 Call UserForm1.Hide End Sub
This is an example section from the audit file:
C:\Users\AndMorty\Desktop\Book1.PIW!test was saved by AndMorty at 2/22/2018 3:04:42 PM Reason: changed VBA C:\Users\AndMorty\Desktop\Book1.PIW!test was saved by AndMorty at 2/22/2018 3:04:56 PM Reason: 1 more square C:\Users\AndMorty\Desktop\Book1.PIW!test2 was saved by AndMorty at 2/22/2018 3:22:48 PM Reason: created display 2 C:\Users\AndMorty\Desktop\Book1.PIW!test was saved by AndMorty at 2/22/2018 3:23:07 PM Reason: Added arc C:\Users\AndMorty\Desktop\Book1.PIW!test2 was saved by AndMorty at 2/22/2018 3:23:24 PM Reason: Added 3 cirlces
Since the code is all within a userform, it's easy to export to a file, then import it into all future displays entries.
Finally, if there are resources available for a true development effort, then custom toolbar save buttons can be written that have this functionality built in, and the existing save buttons (both in the File menu and the standard toolbar) can be removed and replaced with these buttons.
Book1.PIW.zip 16.1 KB