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 criti

ITPro Today

May 5, 2004

1 Min Read
ITPro Today logo in a gray background | ITPro Today

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.

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like