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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Button to save a folder outside Access

Status
Not open for further replies.

RezaNana

Programmer
Dec 18, 2002
80
MY
G'dday..i need some help.
I would like to make a button(inside Access) that can save a folder/file which is located outside Access. Example..if i click this button i can save a folder/file (which i have selected by entering the full path inside VBA i.e C:\MyFolder\MySave)
can some body gimmi the code, which i'm sure it can really be done..rite?
Thanks in advance..
 
Hi
Have you looked at the File System Object (FileSystemObject Object)? This is straight from help:

FileSystemObject.CopyFile "c:\mydocuments\letters\*.doc", "c:\tempfolder\"

The FSO has lots of properties and methods for managing files and folders.

 
If you don't want to create a reference to the FSO object you can use the default VBA.FileSystem commands to do the same.
Code:
'This will make the new directory
VBA.FileSystem.MkDir "[i]C:\NewDirectoryNamePath[/i]"
'This will move a file
VBA.FileSystem.FileCopy "C:\OldFilename.txt", _[i]"C:\NewDirectoryNamePath\NewFilename.txt"[/i]
'This will clean up (delete the old file)
VBA.FileSystem.Kill "C:\OldFilename.txt"
CMP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top