472,117 Members | 1,513 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,117 software developers and data experts.

how to check if an excel spredsheet on a network share is already open by anther user


Not sure if I am in the right section. Just have a query about manipulating excel spreadsheet using vbscript.

I am developing a vbscript which runs on client xp machines to retrieve certain user environment variables and to write the same as a record on an excel spreadsheet placed on a network share where the user has got write access to. However, due to the massive number of users in the domain it is expected that the same excel spreadsheet is likely to be used simultaneously by more than one user during which time my script fails and the user encounters an unexpected 'save/save as' excel dialog which he/she was not expecting in the first place(the script is expected to run without the knowledge of the user who has logged on). This is caused due to the fact that the xls file is already opened by the script running on another user's machine.

So I am trying to come up with a piece of code where it waits in an infinite loop (i.e. Do{ ......wait in the loop ...... While(XLS is locked) ....continue.......) until the lock on the xls is released and then continues with the rest of the script operation. Is there any way to check this using vbscript?

Please note I have come across scripts that can do a lot of things when the spredsheet in question is present locally on the machine where a lot of things can be done but I haven't come across an example for the above scenario.

Any help/suggestions will be highly appreciated. Thanks in advance!
Feb 9 '09 #1
1 3358
3,406 Expert 2GB
Most obvious way to check in vbscript is to try to save, the error I think is specific to whether the file is in use. You could clear the error and then try to save and the loop could continue until there is no error.

Feb 10 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by Lam | last post: by
6 posts views Thread by Daniel | last post: by
3 posts views Thread by hkappleorange | last post: by
2 posts views Thread by Michael | last post: by
9 posts views Thread by Doug Glancy | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.