PDA

View Full Version : FileCopy to Network Drive



gnod
07-03-2008, 04:58 AM
hi,

i'm trying to copy the file from local drive to SUNSERVER (192.168.64.70) network drive but it gives an error of "File not Found". the file is already exist in my local drive.


Sub CopyFile()

FileCopy "C:\1.txt", "\\192.168.64.70\Manu\tm7211\In\1.txt"

MsgBox "Done...", vbInformation, "File Copy"
End Sub


pls help..

thanks,

RonMcK
07-03-2008, 09:55 AM
gnod,

From File Explorer, can you walk the file tree and get to the folder 'In'?

What happens if you add a ChDir, like the following, and single-step your code? Does the file (1.txt in your code) exist on the destination?
Sub CopyFile()

ChDir "\\192.168.64.70\Manu\tm7211\In\"
FileCopy "C:\1.txt", "\\192.168.64.70\Manu\tm7211\In\1.txt"

MsgBox "Done...", vbInformation, "File Copy"
End Sub
Cheers,

gnod
07-07-2008, 08:26 AM
Thanks for your reply..

i will try using ChDir..

1.txt does not exist in the destination.. that will be the file that i want to copy.. if the destination is not a network drive, there is no problem with that syntax..

ex: if i use this syntax then copy it to my other local drive, there is no error.


FileCopy "C:\1.txt", "D:\Manu\tm7211\In\1.txt"




thanks..

JKwan
07-07-2008, 09:17 AM
Just currious, have you tried mapping your drive first - say to drive K: and then copy the file. Maybe FileCopy command does not support UNC?

RonMcK
07-07-2008, 09:22 AM
gnod,

Can you perform your file copy from the dos box on you PC?

c:\FileCopy "C:\1.txt", "\\192.168.64.70\Manu\tm7211\In\1.txt"
Is 192.168.64.70 your PC or another machine? If not your PC, do you need to have write permission for it? If so, has it been set up for you? Just wondering.

Cheers!

gnod
07-07-2008, 10:19 PM
RonMck,

ChDir doesn't work. it generates error "Path not Found".

i didn't try FileCopy in a dos box because FileCopy is a VBA Statement not a command

192.168.64.70 is a network drive, not my PC.. and it has a write permission on that folder..


JKwan,
i already tried maping the drive but still doesn't work.. it generate "File Not Found"..


thanks,

RonMcK
07-08-2008, 06:21 AM
gnod,

So, instead of FileCopy you could try using Copy at the DOS prompt, however, I believe that will give the same 'file not found' error.

Something is wrong in your path. I wouild use File Explorer to walk from '192.168.64.70' out to your destination subfolder: 'In'; you'll discover a difference between the path you've given us and the 'real' path.

Thanks,

gnod
07-16-2008, 08:40 AM
is there any other way rather than using the FileCopy Statement??

RonMcK
07-16-2008, 09:04 AM
Something is wrong in your path. I wouild use File Explorer to walk from '192.168.64.70' out to your destination subfolder: 'In'; you'll discover a difference between the path you've given us and the 'real' path.

Have you tested your path to verify that it is correct? Have you consulted with your network administrator?

HTH,

gnod
07-16-2008, 09:16 AM
the path is correct..
what i do not know is the FileCopy can read the ip add of the other computer or is it only for local drive

RonMcK
07-16-2008, 09:38 AM
I looked for help on the Microsoft Knowledgebase and found an article that's not quite your problem but may have some insights. It's in Access not Excel.

http://support.microsoft.com/kb/207703/en-us

I'm getting out of my depth. I hope some others will jump in and also help you with this issue.

HTH,

gnod
07-16-2008, 09:49 AM
thanks for your reply..

i will try the API and the DOS command procedure when i get back to office..
have you tried copying a file using copy command (DOS) to network drive?

RonMcK
07-16-2008, 02:29 PM
gnod,

I'm running a Mac here at work; when I attempt to chdir to a URL instead of a 'name' I get 'no such file or directory'. I asked one of our Help Desk to try it from her PC and she's unable to do it either.

I think you'll need to get and use the 'name' of the server rather than its IP address. One advantage of this will be that your VBA Code will not break when or if the IP address changes for that other PC.

HTH,

gnod
07-18-2008, 12:09 AM
hi,

i also experience "File not found" using the DOS command.
in using API command i didn't get any error but it doesn't copy to the destination.
i also try using the Computer name of the server instead of the ip address..


:(