请告诉我关于文件复制的语句,如:我想将d:\txt1 复制到e:\下,怎么实现?
如何判断e:\下是否有txt1文件存在?
谢谢!

解决方案 »

  1.   

    FileCopy "d:\txt1", "e:\txt1"
      

  2.   


    If Dir("d:\txt1") <> "" Then
        MsgBox "文件存在!", vbExclamation
    Else
        MsgBox "文件不存在!", vbExclamation
    End If
      

  3.   

    If Dir("e:\txt1") <> "" Then
        MsgBox "文件已存在!", vbExclamation
    Else
        FileCopy "d:\txt1", "e:\txt1"
    End If
      

  4.   

    If fileexists("e:\txt1") <> "" Then
        MsgBox "文件已存在!", vbExclamation
    Else
        FileCopy "d:\txt1", "e:\txt1"
    End If
      

  5.   

    FSO嗯
    不过只是复制用FileCopy 就行了,不过要注意文件读保护时使用会出错,应用on error处理
      

  6.   

    FSO嗯
    不过只是复制用FileCopy 就行了,不过要注意文件读保护时使用会出错,应用on error处理
      

  7.   

    CopyFile VB声明 
    Declare Function CopyFile Lib "kernel32" Alias "CopyFileA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal bFailIfExists As Long) As Long 
    说明 
    复制文件。与vb的filecopy命令相似 
    返回值 
    Long,非零表示成功,零表示失败。会设置GetLastError 
    参数表 
    参数 类型及说明 
    lpExistingFileName String,源文件名 
    lpNewFileName String,目标文件名 
    bFailIfExists Long,如果设为TRUE(非零),那么一旦目标文件已经存在,则函数调用会失败。否则目标文件被改写