[AccessD] Copy a folder with VBA

Stuart McLachlan stuart at lexacorp.com.pg
Thu Sep 11 17:11:06 CDT 2003


On 11 Sep 2003 at 10:31, Lonnie Johnson wrote:

> Is there a quick or slick way to copy an entire folder to a different
> drive and folder name with VBA. Simular to the FileCopy source,
> destination statement? 
> 
> 

In straigth VBA

Dim strOriginDir as String
Dim strDestDir as String
Dim strFilename as String

strFilename = Dir$(strOriginDir & "*.*")
While strFilename > ""
   Filecopy strOriginDir & strFilename, strDestDir & strFilename
Wend

or more simply, use the OS

SHELL ("Copy " & strOriginDir & "*.* " &  strDestDir, vbHide)

Note, you can Shell to  XCopy instead and use various switches if you 
need more control over exactly what you copy



 
-- 
Lexacorp Ltd
http://www.lexacorp.com.pg
Information Technology Consultancy, Software Development,System 
Support.





More information about the AccessD mailing list