Copy Method

mr_e_landis

Registered User.
Local time
Yesterday, 19:07
Joined
Feb 16, 2005
Messages
28
I don't know why this won't work? I get the good old run-time error '13': Type mismatch. I'm guessing that it has something to do with setting my object as a string. In which case how would I get the Copy Method to execute correctly? The object is required and is always the name of a file or folder object. How would I get it to equal that?

object.Copy destination[, overwrite]

Code:
Dim MyCopy As Object
Dim i

vbFileName = "<myfilename>" 'any file with any extension
vbOriginalDir = "C:\TEMP"
vbNewDir = "X:\Data\REF001\Additional Files"

Set MyCopy = vbOriginalDir & "\" & vbFileName
i = vbNewDir & "\" & sFileName

MyCopy.Copy i
Thank you all. The help is very much appreciated :)
 
I would use the FileCopy function.
 
Code:
FileCopy source, destination

Who'd of though...? That works great... I wonder why a vb help search didn't yield that one when I searched for "Copy File"? Thanks for the help it has been very much appreciated.
 

Users who are viewing this thread

Back
Top Bottom