Solved

Close a file

Posted on 2006-11-07
10
163 Views
Last Modified: 2010-04-30
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
0
Comment
Question by:CCIG2006
10 Comments
 
LVL 65

Expert Comment

by:Jim Horn
Comment Utility
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.
0
 
LVL 11

Accepted Solution

by:
Dany Balian earned 500 total points
Comment Utility
'here's what u should do
'here's the vbs script

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "NET SESSION /DELETE /y" 'run batch file, Use your absolute path here
SET WSHSHELL=nothing

'i tried it, it works...
 hope this is what u want...

cheers,

dan
0
 
LVL 4

Expert Comment

by:JRCSystems
Comment Utility
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)
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 11

Expert Comment

by:Dany Balian
Comment Utility
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
0
 
LVL 4

Expert Comment

by:JRCSystems
Comment Utility
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
 
0
 

Author Comment

by:CCIG2006
Comment Utility
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
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

744 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

17 Experts available now in Live!

Get 1:1 Help Now