Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA - Had to use UNC file path

Status
Not open for further replies.

jleites

Programmer
Mar 1, 2003
41
US
In my VBA code, I wanted to move a file placed into a shared folder on my desktop, to another folder on my notebook.

I could see the file in the shortcut folder on my notebook, but the FileCopy instruction returned a "file not found" error.

When I changed the FileCopy instruction to address the UNC file path instead of the shortcut file path, it work fine.

Why won't it work with the shortcut folder?
 
Hi j,

How are you referring to the shortcut to get the path held within it?

You must of course supply the full path to that shortcut, e.g. C:\Documents and Settings\All Users\Desktop\etc etc

No?

ATB

Darrylle





Never argue with an idiot, he'll bring you down to his level - then beat you with experience.
 
The actual files are on my desktop in a shared folder.

The VBA program is on my notebook.

This instruction worked:
FileCopy "\\Ourdesktop\TempShareFolder\FileName.txt", "c:\Jeff\Data\FileName.txt"

This instruction did not work:
FileCopy "c:\TempShareFolder\FileName.txt", "c:\Jeff\Data\FileName.txt"

C:\TempSharefolder is a shortcut to \\Ourdesktop\TempShareFolder and using IE, the files were visable via the shortcut.

One other note, I first tested the FileCopy on the desktop, where the file actually resided, and the FileCopy worked on the desktop using the shortcut path.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top