Solved

Determining if files are open

Posted on 1998-11-19
3
126 Views
Last Modified: 2010-05-03
I have some files that are sitting on a folder on an NT Server. From my Win95/98 workstation I would like to determine if the files are currently open by another user. I would appreciate any source code or suggestions that anybody would have.
0
Comment
Question by:Sanju043097
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
vikiing earned 50 total points
ID: 1445669
Try to open the file this way:

   On error resume next
   Open "filename.ext" for input lock read write as #1
   errcode = err        'Catch possible error
   Close #1
   If errcode=70  then      '70 = Permission denied
       <file is open by another user>

It's possible the so-generated error (if the file is already open) be a different number, so first run the program without On Error and see what happens.

0
 

Author Comment

by:Sanju043097
ID: 1445670
Thanks, that worked great.
0
 
LVL 3

Expert Comment

by:vikiing
ID: 1445671
Sanju: with that piece of code, ¿is really 70 the error value you get?. I was not sure, then I suggested the most probable one.

0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now