Copy folder to another folder in VBA

Viewed 77

I want to copy one folder among many folders and paste it to another location. How can I achieve this using VBA?

I am using the below code but it copies all the folders and save it. I just want to copy one folder.

Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")

FSO.CopyFolder Source:=FromPath1, Destination:=ToPath

FromPath1 has many folders. Say a,b,c,d,e. I just want to copy a and save it to ToPath.

1 Answers

Change your FromPath1. For example, instead of "C:\Temp" use "C:\Temp\a"

Related