Link to home
Start Free TrialLog in
Avatar of CCIG2006
CCIG2006Flag for Canada

asked on

Close a file

If someone has a file open (either .txt, .mdb, etc...) in Win XP Pro over a network, it cannot be deleted because someone is tying it up.  How can I "terminate" this connection in order to be able to delete/rename the file?

This question is a  ** RUSH ** request.

Thank you,
Mike
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

There is no way that I know of to terimante a network connection with *any* file.

For Access apps, you can create custom programming to kick out users on a networked app.
ASKER CERTIFIED SOLUTION
Avatar of Dany Balian
Dany Balian
Flag of Lebanon image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think MrDany solution will work... looks like it.
I would only question why involve Windows Scripting Shell.
The same command can be run directly from the built-in vb Shell command.
Dim plResult as Long

plResult = Shell("CMD.EXE /C NET SESSION /DELETE /Y", vbNoFocus)
Hey jrcsystems,

thanks for pointing out to the shell command.

but the script that i gave was a vbs script cos i wasnt sure if Mike wanted a script for vb6 or vbs..

my solution works in both vb6 and vbs while the shell command is available only in vb6...

cheers,

Dan
Dan,

No problem. There is a place for scripting. I work almost exclusively in VB6 apps. Been in VBx for years.

I simply try to avoid scripting where possible because for Apps that are distributed outside the company,
(where you don't have control of sending out memos, telling collegues what to do)
too many anti-virus programs will raise a flag saying your App is trying to run a malicious script.
(even though it doesn't have a clue exactly what you are attempting).

John
 
Avatar of CCIG2006

ASKER

My wife has recently passed away and I am trying to take care of things.  I have not had time to review the answers, so I ask that you please allow more time.

Your cooperation is greatly appreciated.

Thank you,
Mike