How to Copy File or Workbook in Excel VBA?

In this post, you’ll learn how to copy file or Workbook in simple steps using Excel VBA.

Copy File or Workbook in Excel VBA

To copy a file or workbook you can use the FileSystemObject(FSO)command. With this you can access the file system of your computer.

Copy A File or a Workbook

To copy a file or a workbook,

Code:

Dim FSO As Object

 Set FSO = CreateObject("Scripting.FileSystemObject")

 Call FSO.CopyFile("C:\Excel VBA \ Excel VBA 1.xlsx", "C:\ Excel VBA \", True)

Copy and Rename a File

To copy and rename a file,

Code:

Dim FSO As Object

Set FSO = CreateObject("Scripting.FileSystemObject")

Call FSO.CopyFile("C:\Excel VBA\Excel VBA 1.xlsx", "C:\Excel VBA\Sample file.xlsx")
How to Copy File or Workbook in Excel VBA?

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In this article, you will learn about the SKEW.P function, the formula syntax and usage of the function in Microsoft...
In this article, you will learn about the SKEW function, the formula syntax and usage of the function in Microsoft...
In this article, you will learn about the RANK.EQ function, the formula syntax and usage of the function in Microsoft...
  • Excel
  • November 23, 2021