如何在VB6中复制打开的文件? [英] How do I copy an open file in VB6?

查看:30
本文介绍了如何在VB6中复制打开的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用VB6,当文件被其他人打开时,如何将文件从另一台计算机复制到我的计算机?

Using VB6, how do I copy a file from another computer to my computer when the file is opened by another person?

推荐答案

如果您尝试对当前打开的文件使用 FileCopy 语句,则会发生错误.但是,FileSystemObject 的 CopyFile 函数没有问题,因此请改用它.首先,您需要添加对 Microsoft Scripting Runtime 的引用(在 Project->References... 菜单上).然后你可以这样做:

If you try to use the FileCopy statement on a currently open file, an error occurs. However, the FileSystemObject's CopyFile function doesn't have a problem with it, so use that instead. First, you will need to add a reference to the Microsoft Scripting Runtime (on the Project->References... menu). Then you can do this:

Dim fso As New FileSystemObject

fso.CopyFile "\\someOtherComputer\share\foo.mdb", "C:\foo.mdb"

这篇关于如何在VB6中复制打开的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆