1 1 1 1 1 1 1 1 1 1 Rating 0.00 (0 Votes)

Für 32Bit und 64Bit Office Versionen

Problemstellung:

Wie kann ich eine Datei kopieren?

Public Function CopyFileVBA(strSourceFile As String, strTargetFile As String)
'*******************************************
'Name:      CopyFileVBA (Function)
'Purpose:   Datei kopieren
'Author:    Tommyk
'Date:      März 11, 2004, 04:16:40
'Inputs:    strSourceFile=Pfad und Name der Quelldatei, strTargetFile= Pfad und Name der Zieldatei
'Output:
'*******************************************
On Error GoTo Err_Handler
    FileCopy strSourceFile, strTargetFile
    
Err_Handler_Exit:
    Exit Function
Err_Handler:
        Dim strErrString As String
        strErrString = "Error Information..." & vbCrLf
        strErrString = strErrString & "Error#: " & Err.Number & vbCrLf
        strErrString = strErrString & "Description: " & Err.Description & vbCrLf
        MsgBox strErrString, vbCritical + vbOKOnly, "Error in Function: CopyFileVBA"
        Resume Err_Handler_Exit
End Function


Aufruf:

CopyFileVBA "C:\Test\Test2\Crypter.dll", "H:\Test\Crypter.dll"

würde die Datei "Crypter.dll" von "C:\Test\Test2" nach "H:\Test" kopieren

 

 

Ähnliche Artikel