Table of contents
TOC
Collapse the table of content
Expand the table of content

FileCopy Statement

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Copies a file.

Syntax

FileCopysource,destination

The FileCopy statement syntax has thesenamed arguments:

PartDescription
sourceRequired. String expression that specifies the name of the file to be copied. The source may include directory or folder, and drive.
destinationRequired. String expression that specifies the target file name. The destination may include directory or folder, and drive.

Remarks If you try to use the FileCopy statement on a currently open file, an error occurs.

Example

This example uses the FileCopy statement to copy one file to another. For purposes of this example, assume that is a file containing some data.

Dim SourceFile, DestinationFile 
SourceFile = "SRCFILE" ' Define source file name. 
DestinationFile = "DESTFILE" ' Define target file name. 
FileCopy SourceFile, DestinationFile ' Copy source to target. 
© 2018 Microsoft