Copying files between folders

  • Thread starter Thread starter Ray
  • Start date Start date
R

Ray

Hi,

I have a macro which imports 8 text files to update my
database. currently i have to manually copy the text
files from their folders to my "update folder" and then
run the macro. is there a way to get access to copy the
files for me.

Thanks
Ray
 
Here are two methods

Private Sub Command10_Click()
FileCopy "sourcefile", "destinationFile"
End Sub

or if the file is in use try

Private Sub Command10_Click()
Dim fso As Object
Dim boverwrite As Boolean
Dim fso As New Scripting.FileSystemObject

Set fso = CreateObject("Scripting.fileSystemObject")

fso.copyfile "sourcefile", "destinationFile"

Set fso = Nothing

End Sub

Jim
 
Thanks
-----Original Message-----
Here are two methods

Private Sub Command10_Click()
FileCopy "sourcefile", "destinationFile"
End Sub

or if the file is in use try

Private Sub Command10_Click()
Dim fso As Object
Dim boverwrite As Boolean
Dim fso As New Scripting.FileSystemObject

Set fso = CreateObject("Scripting.fileSystemObject")

fso.copyfile "sourcefile", "destinationFile"

Set fso = Nothing

End Sub

Jim

.
 
Back
Top