如题。已知ip、共享文件的目录。另外,在vba中使用vb的api函数有什么要求没有?谢谢!

解决方案 »

  1.   

    Private Type SHFILEOPSTRUCT
         hwnd As Long
         wFunc As Long
         pFrom As String
         pTo As String
         fFlags As Long
         fAnyOperationsAborted As Long
         hNameMappings As Long
         lpszProgressTitle As String
    End TypePrivate Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As LongPrivate Sub Form_Load()
        Dim result As Long, fileop As SHFILEOPSTRUCT
        With fileop
                .hwnd = Me.hwnd
                .wFunc = FO_COPY
                .pFrom = "C:\My Documents" & vbNullChar & vbNullChar
                .pTo = "\\SQL\董博士\" & vbNullChar & vbNullChar
                .fFlags = FOF_SILENT Or FOF_NOCONFIRMATION
            result = SHFileOperation(fileop)
        End With
    End Sub