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 post, you’ll learn how to Find Blank cells in excel so that you can remove or delete the blank cells form...
In this article, you’ll learn what is a Gauge Chart in Microsoft Excel. Also, you will learn how to add...
Microsoft Excel provides a shortcut for the users to move columns in excel using two different ways – using Shift...