Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COPY ALL FOLDERS AND CONTENTS TO A NEW LOCATION

Status
Not open for further replies.

BlakeLacy1

Technical User
Jan 12, 2023
3
US
I am looking for Access VBA code to copy a standard set of folders and contents to a new location after I create a project folder.
It seems this should be easy but I have not been successful in finding a way to get this done.
 
Did you try CopyFolder method...?
You would need a reference to a File System Object

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
I tried but could not get it to work. I am not sure if I did something wrong but I kept getting a "Path not found" error on the last step.
I have checked to make sure the path name is correct several times.

I have a reference to: "Microsoft Scripting Runtime" Is that what I need?

Here is what I used. I set these folders up to test. The "FilesFrom" has several folders with subfolders and files and the TEST folder is empty.


Dim FilesFrom As String
Dim FilesTo As String
Dim objFSO As Scripting.FileSystemObject

FilesFrom = "C:\__DWD_Database\_QuoteDirectory(DoNotChange)\_QuoteTemplates(DoNotChange)\RFQ Folder Template\*"
FilesTo = "C:\__DWD_Database\_QuoteDirectory(DoNotChange)\_QuoteTemplates(DoNotChange)\TEST\"

Set objFSO = CreateObject("Scripting.FileSystemObject")

objFSO.CopyFile FilesFrom, FilesTo

Set objFSO = Nothing

 
I figured it out.. I had an error in my string after all..
Thanks for your consideration.
 
[thumbsup2]
Welcome to Tek-Tips [wavey3]

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top