FileCopy

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Thanks in advance,

I am using FileCopy to transfer files thru Access like:-

strFrom = "c:\database\text.txt"

strTo = ?

FileCopy strFrom, strTo

in my access procudure.

I know how to copy from a specific location but how does one copy to desktop?

Thanks

Trev
 
hi Trever,

Trever said:
I know how to copy from a specific location but how does one copy to desktop?
Try %userprofile%\Desktop as destination folder.


mfG
--> stefan <--
 
Stefan Hoffmann said:
hi Trever,


Try %userprofile%\Desktop as destination folder.

That didn't work for me as is, but this did:

strFrom = "C:\Temp\Test.txt"
strTo = Environ("userprofile") & "\Desktop\Test.txt"
FileCopy strFrom, strTo

Granted, the environment string may not be present in all versions of
Windows, and could be doctored externally. One could also take the more
complicated approach of calling the Windows API to get the desktop
folder, using the code posted here:

http://www.mvps.org/access/api/api0054.htm
API: Retrieving a Special Folder's location
 
Hey guys!

Try using this folder location in the destination variable:
"C:\Documents and Settings\All Users\Desktop\"

This will even preclude the security issue of writing to the desktop of
another user who might not possess the appropriate permissions. All users
can write/modify the contents of the 'All Users' profile.
 
Back
Top