+ Reply to Thread
Results 1 to 6 of 6

Macro that saves a copy of document in a different folder location

  1. #1
    Forum Contributor
    Join Date
    04-30-2013
    Location
    arizona
    MS-Off Ver
    365
    Posts
    147

    Macro that saves a copy of document in a different folder location

    I have attached my workbook. I am trying to use this macro to copy and paste a document from one location to another.
    I keep getting run-time error '52' "Bad file name or number".
    I know the file location that I am referencing is correct but it does not seem to be working.
    Can anyone help me with this?
    Thanks,
    Attached Files Attached Files
    Last edited by glide2131; 06-28-2014 at 10:41 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Macro that saves a copy of document in a different folder location

    Why are you adding a "/" at the end of each file name? I didn't set up the files to be able to test it with your data but try this:

    Please Login or Register  to view this content.
    Also, you are running down column C but file names 2-4 are blank. That is bound to cause trouble.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    04-30-2013
    Location
    arizona
    MS-Off Ver
    365
    Posts
    147

    Re: Macro that saves a copy of document in a different folder location

    I deleted the "/" and numbers 2-4 with the same result. If I just paste the file locations straight into the code it works fine.
    For example:
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    04-30-2013
    Location
    arizona
    MS-Off Ver
    365
    Posts
    147

    Re: Macro that saves a copy of document in a different folder location

    What am I missing?

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Macro that saves a copy of document in a different folder location

    I setup folders and files, populated C3:C5 with 1, 2, 3, and columns F and G with file names, and it worked perfectly with the one change I recommended.

    I cannot find anything in your code that would explain why it does not work with reading file names from cells but does work when you hard code the file names. Just for good measure here is the code that works for me:

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    04-30-2013
    Location
    arizona
    MS-Off Ver
    365
    Posts
    147

    Re: Macro that saves a copy of document in a different folder location

    Yep. Got it to work. It was the empty rows of data like you said. Thank you a ton!

+ 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. create new folder at one location and copy photos in that folder from other location
    By meer_ali in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-22-2014, 05:20 AM
  2. [SOLVED] Macro to Copy excel file from a location to a folder on Desktop
    By harish.chinni in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-30-2013, 02:17 AM
  3. Replies: 1
    Last Post: 10-31-2012, 11:19 AM
  4. [SOLVED] Run a Macro every 7 days that saves the file in a different folder
    By Djflare in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-03-2012, 03:33 PM
  5. macro that automatically saves a copy of the XLS document in CSV format
    By WDTrey in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-03-2005, 07:07 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