+ Reply to Thread
Results 1 to 8 of 8

macro to rename pdf files

  1. #1
    Registered User
    Join Date
    10-15-2011
    Location
    bangalore
    MS-Off Ver
    Excel 2010
    Posts
    99

    macro to rename pdf files

    Hi all ,

    I need a macro which can rename the pdf files .scenario is given below.

    i have one single folder. inside that folder i have too many number of folders and every folder have exactly one pdf file , i want to rename pdfs , the name should be the folder name which is containing the pdf. after renaming, copy all the pdf and put it into one single folder called renamed .


    please some body would help me will save me lot of time

    regards
    som

  2. #2
    Registered User
    Join Date
    10-15-2011
    Location
    bangalore
    MS-Off Ver
    Excel 2010
    Posts
    99

    Re: macro to rename pdf files

    guys can any body help me

  3. #3
    Registered User
    Join Date
    10-15-2011
    Location
    bangalore
    MS-Off Ver
    Excel 2010
    Posts
    99

    Re: macro to rename pdf files

    hi guys any idea's

  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: macro to rename pdf files

    Hi,

    (Updated post)

    The subroutine below will rename the PDFs in a specific folder of your choice to the folder name and then copy all the PDFs to a single new location. There are two places for you to change (e.g. where it says "Change here" denoting the start folder and the folder where the files should be copied to).

    I have put in a safeguard against it overwriting files when copying but always, always keep a backup copy of your files. Never run macros on the originals because there is always a slight possibility the results will be different than you expected.

    Here is the code:

    Please Login or Register  to view this content.
    Let me know how it works out.

    abousetta
    Last edited by abousetta; 03-19-2013 at 06:04 AM.
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  5. #5
    Registered User
    Join Date
    10-15-2011
    Location
    bangalore
    MS-Off Ver
    Excel 2010
    Posts
    99

    Re: macro to rename pdf files

    Hi abousetta,

    i was not in town , just came back and went through your macro , its amazing and hats off to you , this going to reduce my burden in huge level , thanks so much for extending your hands

    only one addition can the macro itself generate folder called renamed and put the renamed files inside that

    because if I give the destination folder name as renamed where you said me to change, that fie name in source after renaming is " wert.txt" but when its copies it is the file name becomes "renamedwert.txt" again the folder name is getting added up.and its copying outside in the d: drive but not in the folder.

  6. #6
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: macro to rename pdf files

    Hi,

    I simplified it a bit. It's working fine from my end.

    Please Login or Register  to view this content.
    Let me know if it's still causing you any problems.

    abousetta
    Last edited by abousetta; 03-25-2013 at 03:12 AM. Reason: Modified code

  7. #7
    Registered User
    Join Date
    10-15-2011
    Location
    bangalore
    MS-Off Ver
    Excel 2010
    Posts
    99

    Re: macro to rename pdf files

    now it says path not found , i gave it as d:\renamed\

  8. #8
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: macro to rename pdf files

    The modifications in red above should check if the folder exists and if not then create a new folder called Renamed

    abousetta

+ 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