COPY FILES MACRO

  • Hi,


    i want to copy the list of files from A column and below macro was copied but it was not looping to copied command, can any one help me....



    Range is "Column A" and Msg box is "Column B" Format types .doc, .rtf,.docx , .pdf


    Please anyone help me in this regards or if possible make it as easier to loop and thanks in advance.



    <img src="https://www.ozgrid.com/forum/core/images/smilies/emojione/263a.png" alt=":)" class="smiley" srcset="https://www.ozgrid.com/forum/core/images/smilies/emojione/[email protected] 2x" height="23" data-tooltip="smile" id="wscSmiley_0_0">




    Code
    Range is "Column A" and Msg box is "Column B"  Format types .doc, .rtf,.docx , .pdf
    
    Please anyone help me in this regards or if possible make it as easier to loop and thanks in advance.
    
    
    <img src="https://www.ozgrid.com/forum/core/images/smilies/emojione/263a.png" alt=":)" class="smiley" srcset="https://www.ozgrid.com/forum/core/images/smilies/emojione/[email protected] 2x" height="23" data-tooltip="smile" id="wscSmiley_0_0">

    Edited once, last by royUK: remove text from Code Box to post ().

  • Macro was running properly but not copying the files listed in A column but not giving any error message i think it was not looping here ....


    Can you please help me.......

    1. objFSO.CopyFile Source:=SourcePath & Range("B" & CStr(iRow)).Value & _
    2. sFileType, Destination:=DestinationPath
  • Hi,


    Please check once....




    Please see the above ....


    Settings are the same...

  • Check the Attachment

    The are two Functions

    Sub CopyFiles() This is mine

    Sub CopyFiles1() This is Yours BUT I replaced the B: with A: in



    Code
    If Len(Dir(SourcePath & Range("A" & CStr(iRow)).Value & sFileType)) = 0 Then
    Range("B" & CStr(iRow)).Value = "Does Not Exists"
    Range("B" & CStr(iRow)).Font.Bold = True
    Else
    Range("B" & CStr(iRow)).Value = "Copied"
    Range("B" & CStr(iRow)).Font.Bold = False
    
    
    Plz at the End of your Code  (After the Wend ) and the command :
    Set objFSO = Nothing


    Hope be Ok Now




    Regards

  • Hi


    Am very very thankful to your hard and code was still not copying the files if it exits in my machine...


    I tried a lot but still not working both code and macro was running successfully with out throwing any errors but output folder was always empty ...


    Thank you so much....


    If you have time you can review or else skip this, it might be my excel problem and am very thankful to for your propmt response .....


    Once again Thank You................

  • I've looked at your code and it seems like you need a list of files in the sheet.


    Relying on InputBoxes for the file paths is open to input error though. Not fully tested but let me know if it's better.


  • Hi,


    Thank you for replying ....


    Sorry for inconvenience caused to you, now am attaching the same files in the ZIP folder.

    Please review once and code was running successfully but copying the files into the folder and showing message as "Does not exits" even if it having a same file in the folder.


    Thanks in advance for your consideration.................

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!