Automatically close idle document using
Hello,
We have a word document at work that gets edited/updated by many ppl, problem is sometimes ppl forget it opened and others cant edit it
I needed to put a vba code in this particular document to save & close document if selection does not change for 5 minutes even if user is using the computer for other purposes.
Thanks in advance
Anwsers to the Problem Automatically close idle document using
Download SmartPCFixer for Free Now
Install this code in a module in the document, and save the document as a "Microsoft Word Macro-Enabled Document (*.docm)".
See
http://www.gmayor.com/installing_macro.htm if needed.
Const interval As Double = 5 ' 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
When the document is first opened, it starts a timer.
After 5 minutes (or whatever number of minutes you assign to the constant named 'interval'), the CheckStatus macro will run.
At that time, if the selection has changed since the document was opened (or since
the previous time the CheckStatus macro ran), the selection's location is updated and the timer is restarted.
If the selection is still in the same place, the document will be saved and closed without notice.
In practice, there could be a couple of 'unintended consequences'.
One is that this code doesn't care whether the selection has moved away from its previous location and then back to the same spot (most likely the beginning of the document, start = 0 and end
= 0), so it could close the document prematurely.
Another is that the same careless person might notice immediately that the document has disappeared, and reopen it before anyone else gets a chance.
I don't think much can be done about either of these possibilities.
If you can replace Word 2007 with Word 2013, it allows simultaneous editing of a document by multiple people.
Each user's edits lock only the paragraph(s) that they're editing, and those locks are released when that user saves (and everyone else is notified
to refresh).
Check Windows System Requirements
This error can be due to some configuration requirements for you system. If your PC hardware is not up to par, then make sure you upgrade where necessary before continuing:
Microsoft Windows Requirements :
- 1 gigahertz (GHz) or faster 32-bit (x86) or 64-bit (x64) processor
- 16 GB available hard disk space (32-bit) or 20 GB (64-bit)
Recommended Method to Fix the Problem: Automatically close idle document using:
How to Fix Automatically close idle document using with SmartPCFixer?
1. Click the button to download SmartPCFixer . Install it on your system. Open it, and it will perform a scan for your computer. The errors will be shown in the scan result.
2. After the scan is done, you can see the errors and problems which need to be fixed.
3. The Repair part is done, the speed of your computer will be much higher than before and the errors have been removed. You can also use other functions in this software. Like dll downloading, windows updating and print spooler error repair.
Related: AMD Radeon HD 7800M Win8 not working [Anwsered],I can access the internet, get on facebook and get to hotmail, but I can't play games on facebook and I can't open or respond to my e-mails,I keep getting this Media Player error when I log on my computer. [Anwsered],[Anwsered] System Hanging on shutdown and restart,Unable to get the Vlookup property of the WorksheetFunction class,Solution to Error: Error: "0x81000032 make sure the C: drive is online and set to NTFS" when trying to backup to external hard drive.
,Troubleshoot:External Hard Drive not listed in Windows 7 backup wizard Error
,I'm always being signed off so annoying Tech Support
,Solution to Problem: Impossible to use Internet Explorer! I keep getting the same error message every time i try to use IE.
,Solution to Problem: Referencing data in another file
,Troubleshoot:Error: "0x81000032 make sure the C: drive is online and set to NTFS" when trying to backup to external hard drive. Error,External Hard Drive not listed in Windows 7 backup wizard Tech Support,Tech Support: I'm always being signed off so annoying,Solution to Problem: Impossible to use Internet Explorer! I keep getting the same error message every time i try to use IE.,Referencing data in Access using Excel [Anwsered],Need Best Way To Present Data [Anwsered],Same question but for windows 7 home edition,sometimes fullscreen won't activate [Solved],Solution to Error: We bought a new computer with windows 7 and it is constantly freezing. How do we fix this?,Solution to Error: Windows 8 update crash (2013-07-22)
Read More: Tech Support: Automatic CAPS LOCK toggle when certain applications are active,[Solved] attach freecell icon to taskbar,[Solved] Backup error 0x80070002 when i try to back up to Maxtor one touch 4,Tech Support: Automatically Assign ID Number to Set of Records and Loop Until End,Back button mostly unresponsive after viewing PDF file in browser window Tech Support,application not found error,any problems in a team where one has Windows XP and the other has Windows 7?,Application/Object-Defined Error,An Excel formula question where hours are totalled and cumulating,Anyone know the hardware email?
No comments:
Post a Comment