+ Reply to Thread
Results 1 to 4 of 4

copy a file several times, rename it and place in a specific folder

  1. #1
    Registered User
    Join Date
    11-14-2013
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    8

    copy a file several times, rename it and place in a specific folder

    Hi All,

    I want to be able to copy an excel file from a specific location (chosen by the user), and paste it a number of times (user would input this number say in cell ref a1) and then it would be pasted in to another specific folder (chosen by the user).

    Would it be possible to do this (if not the above is fine).... so it copies a file (chosen by user), but the amount of times to copy it depends on how many entries are in a specific column which is also used to rename the files.

    So in column A it would bring up the file, Column B would show what file it is to be renamed to and then the last column would be the target where this file needs to be copied and pasted to.

    The number of entries of the names would determine the amount of files copied.

    Thank you

  2. #2
    Registered User
    Join Date
    11-16-2013
    Location
    France
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: copy a file several times, rename it and place in a specific folder

    Hi,

    To copy a file, use FileCopy
    Please Login or Register  to view this content.
    source: http://msdn.microsoft.com/fr-fr/libr...=vs.90%29.aspx

    To choose a file, useFileDialog(msoFileDialogFilePicker)
    http://msdn.microsoft.com/en-us/libr...ice.11%29.aspx

    To choose a folder it is similar but use FileDialog(msoFileDialogFolderPicker) instead of FileDialog(msoFileDialogFilePicker)

    To loop on names use something like
    Please Login or Register  to view this content.
    where A12 is the first name location, the test i<1000 is optional

    ben

  3. #3
    Registered User
    Join Date
    11-14-2013
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: copy a file several times, rename it and place in a specific folder

    Hi Ben,

    How do I link the the copy file to the loop names?

  4. #4
    Registered User
    Join Date
    11-16-2013
    Location
    France
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: copy a file several times, rename it and place in a specific folder

    In the loop, you can get the string of the name with
    Please Login or Register  to view this content.
    If the DestPath string does not finish with a backslash, use
    Please Login or Register  to view this content.
    If you are new to Excel programming, you can find many good links here >> http://www.excelforum.com/excel-prog...ml#post3414753

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] get file, copy and rename to common folder
    By zhaype in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-09-2013, 07:57 PM
  2. [SOLVED] Copy sheet to new file and rename 52 times one per week
    By Greaser2k in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-20-2012, 03:53 PM
  3. Search a word file in a specific folder and copy text to excel
    By corinereyes in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-02-2012, 08:15 AM
  4. [SOLVED] import every file in the folder and rename sheet to the imported file name
    By vivek_work in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 09-04-2012, 02:46 PM
  5. rename & copy *.xls file in the folder then move
    By farrukh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-13-2011, 12:22 PM

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