FileCopy Error 52

S

simon

Hi all,

i got a VBA question on the FileCopy Function:

I'm using FileCopy in an Excel VBA Macro to copy an old file to a new
file . Usually all works fine.
But one client uses a some Windows Server environment (sorry for being
so unspecific: I'm usually on unix environments) and there I get Error
52 'Source or Destination is invalid or not specified.'.

Below you can see the pseudo-code of the my code. I'm checking if
oldFile and neuesFile have been set and if they are set correctly. I
even printed oldFile and neuesFile out to check if they are set. They
are...

oldFile = Application.GetOpenFilename()
'here I check if oldFile is set
neuesFile = Application.GetSaveAsFilename(initialFilename:=oldFile)
'here I chekc if neuesFile is set correctly
FileCopy oldFile, neuesFile
'I tried too: FileCopy CStr(oldFile), CStr(neuesFile) 'same error

The documentation tells me that:
"
- If you try to use the FileCopy function on a currently open file, an
error occurs.

- FileCopy requires full trust to work on the local drive.
"
Supposing the second problem appears, does anybody know what full
trust means?
I'm almost sure that my Error 52 means, that there must be some
problem concerning the rights for the files this users tries to copy.
Since this problem occurs only for some clients and I'm definitively
sure that the arguments are set despite to the ArgumentException 52.

Has anybody any experience with this problem? Can you tell me, how the
rights must be set, that FileCopy works fine?
Or do you have other ideas why this error may occur?

thanks

simon
 

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