In VBA for Word, CopyFolder is a method of the FileSystemObject object, provided by the Microsoft Scripting Runtime library. It is a single, established method name, not a combination of separate Copy and Folder commands. It is not a native VBA language statement, but you can use it in Word VBA through the FileSystemObject object.
The CopyFolder method copies a folder and its contents, including files and nested subfolders. Its syntax is:
object.CopyFolder source, destination, [overwrite]
The object is a FileSystemObject instance. The source specifies the folder or folders to copy, and the destination specifies where they should be copied. The optional overwrite argument determines whether existing files are overwritten; its default value is True. Wildcards can be used in the source path to copy multiple matching folders.
For example, the following Word VBA code copies the Reports folder and its contents to D:\Archive\Reports:
Sub CopyReportsFolder()
Dim fso As Object
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFolder "C:\Reports", "D:\Archive\Reports"
Set fso = Nothing
End Sub
There is also a separate Copy method available on individual File and Folder objects. For example, calling Copy on a Folder object copies that folder and its contents. The distinction is that Folder.Copy operates on a specific folder object, while FileSystemObject.CopyFolder accepts source and destination paths and supports wildcard patterns for copying multiple folders.
Note that CopyFolder does not create missing parent directories in the destination path. The destination's parent directory must already exist. If a destination folder already exists, the copied source folder's contents may be placed inside it, depending on the source and destination paths.
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin