+ Reply to Thread
Results 1 to 3 of 3

Moving a file from one folder to another

  1. #1
    Forum Contributor
    Join Date
    09-27-2004
    Posts
    133

    Question Moving a file from one folder to another

    Excel 2002 with Visual Basic 6.3

    I have a file, say it's called test.txt, in C:\. During the course of running a particular macro I would like to find that file, move it and save it to another folder, say C:\My Documents.

    Any ideas for the procedure?

    Thanks

  2. #2
    Liedson31
    Guest

    RE: Moving a file from one folder to another

    Hi Scantor
    try this one:

    Dim fs
    Set fs = CreateObject("Scripting.FileSystemObject")

    FileCopy "c:\book1.xls","c:\My Documents\book1.xls" 'this one copy
    fs.DeleteFile ("c:\book1.xls"), FORCE:=True 'this one delete

    cheers
    Miguel

    "scantor145" wrote:

    >
    > Excel 2002 with Visual Basic 6.3
    >
    > I have a file, say it's called test.txt, in C:\. During the course of
    > running a particular macro I would like to find that file, move it and
    > save it to another folder, say C:\My Documents.
    >
    > Any ideas for the procedure?
    >
    > Thanks
    >
    >
    > --
    > scantor145
    > ------------------------------------------------------------------------
    > scantor145's Profile: http://www.excelforum.com/member.php...o&userid=14766
    > View this thread: http://www.excelforum.com/showthread...hreadid=383519
    >
    >


  3. #3
    Tom Ogilvy
    Guest

    Re: Moving a file from one folder to another

    name "C:\test.txt" as "C:\My Documents\test.txt"

    --
    Regards,
    Tom Ogilvy

    "scantor145" <[email protected]> wrote
    in message news:[email protected]...
    >
    > Excel 2002 with Visual Basic 6.3
    >
    > I have a file, say it's called test.txt, in C:\. During the course of
    > running a particular macro I would like to find that file, move it and
    > save it to another folder, say C:\My Documents.
    >
    > Any ideas for the procedure?
    >
    > Thanks
    >
    >
    > --
    > scantor145
    > ------------------------------------------------------------------------
    > scantor145's Profile:

    http://www.excelforum.com/member.php...o&userid=14766
    > View this thread: http://www.excelforum.com/showthread...hreadid=383519
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1