+ Reply to Thread
Results 1 to 7 of 7

How to add 2 features to a file transfer macro.

  1. #1
    Registered User
    Join Date
    01-12-2019
    Location
    Seattle
    MS-Off Ver
    Office 2016
    Posts
    4

    How to add 2 features to a file transfer macro.

    I have the following Macro below and I wonder if anyone can help me modify it to do the following two things:
    • Move to the next line when there's and error. Sometimes when a file is being copied to a folder, someone else has a file with the same name open.
    • Create a new tab with a list of the lines that didn't run due to errors.

    Thank you



    Please Login or Register  to view this content.
    Last edited by forkenbrock; 01-13-2019 at 04:36 AM.

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,595

    Re: How to add 2 features to a file transfer macro.

    1)
    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    2) Untested.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-12-2019
    Location
    Seattle
    MS-Off Ver
    Office 2016
    Posts
    4

    Re: How to add 2 features to a file transfer macro.

    Thank you jindon, this is awesome. I've been testing on my C: drive. The report transfers the files, but gives an error when a copy of the file being saved is already open. It says "Run-time Error '70': Permission denied". In debug it stops at "FileCopy e(0), e(1)".

    Please Login or Register  to view this content.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,595

    Re: How to add 2 features to a file transfer macro.

    Not sure why, but see what happens.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-12-2019
    Location
    Seattle
    MS-Off Ver
    Office 2016
    Posts
    4

    Re: How to add 2 features to a file transfer macro.

    Hello jindon. It seems to give the same error and stop at about the same place.

    fso.CopyFile e(0), e(1), True

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,595

    Re: How to add 2 features to a file transfer macro.

    What are the both value for e(0) and e(1) when you get into a debug mode?

    You can see when you hover over the cursor (not click) the variable.

  7. #7
    Registered User
    Join Date
    01-12-2019
    Location
    Seattle
    MS-Off Ver
    Office 2016
    Posts
    4

    Re: How to add 2 features to a file transfer macro.

    This is what it says:

    e(0) = "C:\Test_C\US WEST REGIONCOMP.xls"
    e(1) = "C:\Test_D\US WEST REGIONCOMP - 2018-12-31.xls"

    In this case the destination file in folder D was the one that was open. If I open the file in destination folder B, then e(0) refers to folder A and e(1) refers to folder B.
    Last edited by forkenbrock; 01-17-2019 at 06:13 PM.

+ 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] Macro code to transfer data to another file
    By RA_Lek in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-04-2015, 08:09 PM
  2. Macro to transfer data from multiple workbooks into separate sheets of master file
    By salva7ore in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-20-2014, 08:18 PM
  3. Macro to Open a file, transfer data, save and close
    By tforbes75 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-01-2011, 11:59 AM
  4. Userform to Control Macro Features. Macro = Search for File Type
    By R_S_6 in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 12-13-2010, 11:51 AM
  5. macro to transfer data from one file to another
    By sha_ch in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-22-2010, 12:31 AM
  6. filter features+macro
    By excellentexcel in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 01-09-2009, 10:31 AM

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