If this script is run prior to opening a word doc it pops a little box asking if you want to save your doc. I want it to repeat every 10 or 15 minutes (sleep?) prompting the user to save their work. Since there is no autosave function in Office (only autorecover for when it crashes) I'm trying to make a script to do just that. I could have it monitor the other Office apps too to cover all the bases.
Code:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecNotificationQuery("SELECT * FROM __InstanceCreationEvent WITHIN 2 WHERE TargetInstance ISA 'Win32_Process'")
Do Until DefResp = vbNo
Set objNewProcess = colProcesses.nextEvent
If objNewProcess.TargetInstance.Name = "WINWORD.EXE" THEN
set WshShell = WScript.CreateObject("WScript.Shell")
DefResp = MsgBox (MyNum & " Do you want to save now?", vbYesNo)
WshShell.SendKeys "^s"
End If
Loop