+ Reply to Thread
Results 1 to 6 of 6

Copy Most Recent File to another Directory

  1. #1
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Copy Most Recent File to another Directory

    I've got this code that will copy data into my worksheet from the most recent .IRP file generated on my C:/ drive.
    Along with copying the data to my worksheet, I'd like to have a copy of the IRP file copied to a folder on my L:/Drive.

    In the code section I've commented out the code that allows the data from the most recent file to be copied to my worksheet. I found code that supposedly will copy a file to a new directory. I want to combine this into my code to allow both to happen.
    Here's my attempt.
    Please Login or Register  to view this content.
    Here's the code found in its original state that I would like to use.
    Please Login or Register  to view this content.
    what's in red is what I've tried and errors.
    Any help is appreciated in getting it to work.

    Thanks,

    BDB
    Last edited by bdb1974; 09-14-2009 at 12:52 PM.

  2. #2
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Copy Most Recent File to another Directory

    Ok, I've also tried using this , which does not work.

    Please Login or Register  to view this content.
    Any suggestions?

  3. #3
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Copy Most Recent File to another Directory

    Let me start over.

    Below code works for the static filename:IN Stock Status Report - 4717.IRP
    However, I need it to copy most recent file (dynamic)since the filename is always different.
    Hence,

    Sfile = MostRecent(sPath, "IN Stock Status Report - *.IRP")

    Please Login or Register  to view this content.
    I'm able to copy each Most recent file created to my workbook with the use of:

    Please Login or Register  to view this content.
    I'm hoping there's a way to setup the code above to find the most recent file.
    in a similair way my other code finds the most recent file.

    Any help is greatly appreciated.

    Thanks.

  4. #4
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Copy Most Recent File to another Directory

    Bumping.

    Is there a way to have one macro script insert code or genereated name into another section of a different macro code? Reason is.. I've got one code
    that will return the name of the most recent file I want to have copied.
    But, the code that copies will only copy a specified file. As far as I know it
    will not copy multiple files (at this code doesn't seem too).

    This code will read the most recent file.
    Please Login or Register  to view this content.

    Please Login or Register  to view this content.
    Is there a way to have the recent name inserted into the code for the file name within the given path?


    Anyone's help / thoughts most appreciated.

    Thanks,

    BDB

  5. #5
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Copy Most Recent File to another Directory

    Ok, I tried the following in conjunction with the function code. It doesn't error, but it's also doesn't seem to copy anything to my output folder on the L drive (shared) either.
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    12-10-2008
    Location
    Austin
    Posts
    660

    Re: Copy Most Recent File to another Directory

    I can't believe it! I got this working completely on my own.
    Here's my working solution:

    Please Login or Register  to view this content.
    Regards,

    BDB

+ 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