How do you have Visio save/close after certain amount of idle

Started by mcanzo, January 05, 2017, 08:31:32 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mcanzo

I share a doc with 7 users and its a pain when someone forgets to close the document.  I really want for the doc to close fter 15 mins of idle time, but I'm not very savy with VBA.  I've found this code that does exactly what I want, but with a word doc.  Anyone able to modify to work with Visio?

Const interval As Double = 15 ' minutes
Dim selStart As Long
Dim selEnd As Long

Sub AutoOpen()
     selStart = 0
     selEnd = 0
     Application.OnTime When:=DateAdd("n", interval, Now), Name:="CheckStatus", Tolerance:=120
End Sub

Sub CheckStatus()
     If Selection.Start <> selStart Or Selection.End <> selEnd Then
         selStart = Selection.Start
         selEnd = Selection.End
         Application.OnTime When:=DateAdd("n", interval, Now), Name:="CheckStatus", Tolerance:=120
     Else
         ThisDocument.Close SaveChanges:=wdSaveChanges
     End If
End Sub