FileCopy

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
 
S

Stefan Hoffmann

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 <--
 
D

Dirk Goldgar

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
 
G

Guest

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.
 

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