Closed Thread
Results 1 to 5 of 5

VBA to move an excel file to another folder

  1. #1
    tvt
    Guest

    VBA to move an excel file to another folder

    Hello,

    I want to write a macro that takes an existing excel file (workbook) and
    place it in another folder. Basically something that would simulate cutting
    a file from one folder and pasting it in another. Is this possible using
    VBA? If it is, what would be the code or where can i find the code to do so?
    Thanks!

  2. #2
    Harald Staff
    Guest

    Re: VBA to move an excel file to another folder

    Hi

    It's very easy, given that the file and the to-folder already exist:

    Sub MoveFile()
    Name "C:\Temp\Book1.xls" As "C:\Junk\Book5.xls"
    End Sub

    HTH. Best wishes Harald

    "tvt" <tvt@discussions.microsoft.com> skrev i melding
    news:ACC13420-BD17-4375-9246-595EB0D80D9D@microsoft.com...
    > Hello,
    >
    > I want to write a macro that takes an existing excel file (workbook) and
    > place it in another folder. Basically something that would simulate

    cutting
    > a file from one folder and pasting it in another. Is this possible using
    > VBA? If it is, what would be the code or where can i find the code to do

    so?
    > Thanks!




  3. #3
    Dave Peterson
    Guest

    Re: VBA to move an excel file to another folder

    Look up Name in VBA's help.

    Or even FileCopy and Kill.

    These options will work if that file (doesn't have to be an excel workbook)
    isn't open.

    tvt wrote:
    >
    > Hello,
    >
    > I want to write a macro that takes an existing excel file (workbook) and
    > place it in another folder. Basically something that would simulate cutting
    > a file from one folder and pasting it in another. Is this possible using
    > VBA? If it is, what would be the code or where can i find the code to do so?
    > Thanks!


    --

    Dave Peterson

  4. #4
    Forum Contributor
    Join Date
    01-26-2005
    Posts
    108
    Is it possible to select the name (and location) of the file from a value in a cell (or series of cells such as one for directory and one for file name)?
    AND
    Can I trigger an FTP of same file from Excel (using VBA I assume) specifying from and to locations based on values in cells?

  5. #5
    Registered User
    Join Date
    03-20-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: VBA to move an excel file to another folder

    Amazing handy code
    Source: http://www.tek-tips.com
    Please Login or Register  to view this content.

Closed 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