Copying files between folders

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
 
J

Jim/Chris

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
 
R

Ray

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

.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top