Avoiding exceptions caused by locked files

When you trying to do manipulation on a large number of files , you need  to know if the file is locked for writing ,otherwise you may get critical exceptions caused by msgboxs prompt by the application.

lets take Microsoft Word as example.

If the document that your program is trying to manipulate opened by more than one user ,Then  its locked, and if you try to open it by code you will get prompt window that stuck your program.

To avoid this , you can use the function I added , and call it before you open the file

.the function will return Boolean value regarding the file lock state.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.