Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Posts
    106

    Unanswered: Copy and paste files

    I'm developing an Access vba application and I need vba code that will copy and paste files (excel, word, or whateer) from one directory on the pc to another. I do not need for the file to be imported into the database, only the ability to store the link to the file. I appreciate any inputs.

  2. #2
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    You might try the Move Method of the File System Object. See the help file for details.

    Sam

  3. #3
    Join Date
    Feb 2004
    Posts
    106
    Thanks for the quick reply. Here's what I have:
    Dim fs, f, a
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFile(strFileName)
    f.Move "C:\testagain.xls"


    This works great in moving a file from one location to another.
    Last edited by Yildirim; 07-11-06 at 12:41.

  4. #4
    Join Date
    May 2004
    Location
    New York State
    Posts
    1,178
    Here's actual code:

    Code:
        Dim FObj As Object
        
        Set FObj = CreateObject("Scripting.FileSystemObject")
        
        FObj.MoveFile "F:\L\C2710.mdb", "F:\M\C2710.mdb"
    Here's the explanation from the help file:

    object.MoveFile source, destination

    Pretty self-explanatory, actually.

    Sam

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •