+ Reply to Thread
Results 1 to 4 of 4

Copy files from a folder to another

  1. #1
    Registered User
    Join Date
    06-24-2019
    Location
    Brazil
    MS-Off Ver
    2013
    Posts
    2

    Copy files from a folder to another

    Hello Guys!!

    I am trying to code in VBA to copy multiple selected files from a folder to another.
    My idea is to click the button, than select multiple files name in cells range.
    FromFolder would be a Folder that won't change, so i put the folder path (this folder is located in a network).
    The ToFolder is a folder that each user has in your own computer, so before click the button the user needs to put the folder path destination in Cell "A1".


    Code:
    Please Login or Register  to view this content.
    When I run the code, the error 53 appears.
    Does Anyone can help me figured out what is happening?
    Last edited by carlossanoli; 06-24-2019 at 07:56 AM. Reason: Forgot important information

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Copy files from a folder to another

    What is in A1?
    and what is Xval exactly when it fails?
    It is possible you just need a "\" at the end of your paths, but hard to know for sure without more data.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    06-24-2019
    Location
    Brazil
    MS-Off Ver
    2013
    Posts
    2

    Re: Copy files from a folder to another

    Hi!!
    A1 is a path destination folder in disc C.

    I put "\" at the end of the paths and it works to copy one file, but if I select multiple files another error occurs. Now I got the error 13 for type mismatch.
    Xval is empty when it fails, it doesn't receive the "name of the file.zip" that I want to copy.

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Copy files from a folder to another

    how do you "select multiple files"? I assume by making the range several cells?
    I suspect
    Please Login or Register  to view this content.
    should be
    Please Login or Register  to view this content.

+ 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. Replies: 18
    Last Post: 02-18-2019, 07:42 AM
  2. [SOLVED] Copy newest file in folder to a new folder with new name
    By T_BOLT in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-01-2017, 02:25 AM
  3. Replies: 0
    Last Post: 04-21-2014, 04:03 PM
  4. Replies: 0
    Last Post: 01-21-2014, 10:52 AM
  5. Copy file from 1 folder to another folder
    By chidurala_shree in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-23-2013, 08:20 AM
  6. search for a file in a folder based on data, copy and paste it in another folder
    By kboy1289 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-05-2013, 11:47 AM
  7. [SOLVED] Macro to copy file names and data from each file in a folder into master spreadsheet
    By dee1989 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-10-2012, 05:52 AM

Tags for this Thread

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