473,581 Members | 3,046 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

1 New Member
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 3433
jhardman
3,406 Recognized Expert Specialist
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
11835
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, and use @"C:\file.txt"; it worked Thanks a lot
5
4457
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 seperate files server. we have mapped the fodler to a different folder and need to allow the EXE to process on the mapped drive. When I trigger the EXE via...
6
6751
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 about the ability. If not, what advice can u provide? thank you in advance. ur help will be appreaciated.
3
7574
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 OleDbConnection Dim cmdSelectAuthors As OleDbCommand Dim dtrAuthors As OleDbDataReader
2
4145
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 to open the spreadsheet using my log on credentials since they won't have priviliges to access their particular file from the network drive. BTW, I...
2
2415
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) on the same network segment. I mapped a drive on the server to that share. When mapping the drive, I could enter access credentials for the shares...
9
4527
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 TypeOf obj Is IDisposable Then DirectCast(obj, IDisposable).Dispose()
0
1903
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 when I compile it using vb.net 2005 express (1) Open strFileSpec For Input Lock Read As intFn 'error = open not...
0
2635
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 another user before I execute the code?
0
7886
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7920
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8183
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6569
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5685
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5366
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3809
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1413
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.