473,402 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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

Hi,

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 3423
jhardman
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.

Jared
Feb 10 '09 #2

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

Similar topics

8
by: Lam | last post by:
HI anyone knows how can I open a mapped network file in C#? I try string file = @"T:\file.txt"; it shows me the error: "Could not find a part of the path" but if I copy the file to my C dirve,...
5
by: Nirosh | last post by:
Hi All, Can any one suggest me a best way to do this .. I have a thrid party tool "EXE" that we need to use with our web service to manipulate some complex XML files, which reside in a...
6
by: Daniel | last post by:
Hi all, Can i open and edit the excel sheet on web page after downloading? After editing, i close the web page and the excel file auto upload to the server. Is it possible? I really struggling...
3
by: hkappleorange | last post by:
I connect to mdb file using the following codes. How should I modify it if I want to connect to Excel instead ? <%@ Import Namespace="System.Data.OleDb" %> <% Dim conAuthors As...
2
by: Peter S. | last post by:
I have an ASP.NET page that invokes a web control written in C#. What I want to do is (based on the session ID) display a certain spreadsheet that exists on a network drive. I want the webcontrol...
2
by: Michael | last post by:
We have an ASP.NET 2.0 web application running on a Windows 2003 domain controller. Part of that application needs to read and write files from and to a network share ( living on a MAC Xserveraid)...
9
by: Doug Glancy | last post by:
I got the following code from Francesco Balena's site, for disposing of Com objects: Sub SetNothing(Of T)(ByRef obj As T) ' Dispose of the object if possible If obj IsNot Nothing AndAlso...
0
by: hidara | last post by:
I have an excel file that I need to check if its in use by another before i open it. I have found various forms of the follwing code but each one give me the same errors at the following 2 lines...
0
by: hidara | last post by:
Hello there. I'm trying to write a program that will insert data into an excel sheet every time it is excecuted. This file is stored on a network drive. How can VB.net check if the file is open by...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.