+ Reply to Thread
Results 1 to 21 of 21

extract name and copy the location

  1. #1
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    extract name and copy the location

    Dear All

    i have a folder where some files are saved which contain excel,pdf,word and jpeg files,i want first of all extract all file name in column G than all file location in column H,I,J and K accordingly to their file type and fit into column, means if this is excel file it should be in column I, pdf it will in column H and so on..

    all the file names will follow the column G, means if company name in column G is platform if this company name file is only pdf and word than it should in column H and J

    These characters are allowed in filenames: / ? < > \ : * | "

    i tried to made example may more helpful for you

    Adeel
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: extract name and copy the location

    The location is the same for all files as there are in the same folder ...is it?
    Why to put the file name in column G as it exists in column H,I,J,K ?
    Can we store the path of the folder somewhere ?
    - Battle without fear gives no glory - Just try

  3. #3
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: extract name and copy the location

    Dear PCI
    yes, all files contains in same folder and same location, C:\Users\Pervaiz Iqbal\Desktop\All Files\
    i want file name in column G due to as you see the there is some column are behind we will fill the some info as follow the column G, (specially name and mail ID), you can use the any criteria for column G accordingly to H,I,J,K...



    Adeel
    Last edited by adeel1; 02-26-2017 at 02:28 PM.

  4. #4
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: extract name and copy the ocation

    Thinks seems more clearnow, try next code.
    To be launched from the sheet where results must be
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by PCI; 02-26-2017 at 02:43 PM. Reason: file attached + Typo

  5. #5
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: extract name and copy the ocation

    Dear PCI
    i have folder path C:\Users\Pervaiz Iqbal\Desktop\All Files\...all the files are in it, in code i did not see that where i put the folder path to get the result...if i just make run it just pick 4,5 files name in column G form destop and didn't show location

    Adeel
    Last edited by adeel1; 02-26-2017 at 02:56 PM.

  6. #6
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: extract name and copy the location

    It assumes that the file "Work sheet Help.xlsm" with the macro is in the same folder that the files to treat.
    Else how would you like to mention the folder path ... a message box or others ways , please explain.

  7. #7
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: extract name and copy the location

    Dear PCI

    i got your point, now i move that file in that folder and i have results, some issue that some of file name are ending with (.,/\)code not showing there location but they are in column G and similarly file with (.png) showing in column G but not not showing path in said column, and some of files are macro based(word and excel) also not showing location but that is in column G, please look

    Adeel
    Last edited by adeel1; 02-26-2017 at 03:39 PM.

  8. #8
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: extract name and copy the location

    Can you send me some examples of files' name with difficulties.
    Of course for Excel you have to prepare 2 columns

  9. #9
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: extract name and copy the location

    like: MGA INDUSTRIES PVT. (either this is word or excel or pdf)
    you can see there is dot in end, this type of files are showing in column G but location is not appearing in concern cell and column & all those files which saved with macro enabled..

    Adeel
    Last edited by adeel1; 02-26-2017 at 04:16 PM.

  10. #10
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: extract name and copy the location

    What is the full name?
    MGA INDUSTRIES PVT.docx
    MGA INDUSTRIES PVT.pdf
    I have no concerns
    An issue could be if there was several . in the file name, is it the issue ?
    See next code

    Please Login or Register  to view this content.
    Last edited by PCI; 02-26-2017 at 06:10 PM.

  11. #11
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: extract name and copy the location

    Dear PCI
    now its working for only pdf and excel ended with (dot), there is no location for word file now, find attached file with yellow highlighted

    Adeel
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: extract name and copy the location

    In the code sent see the selection done versus the file extension
    Please Login or Register  to view this content.
    For example:
    if the file has the "DOCX" extension (Word file ...?) it will be recorded in column I
    What do you mean by " ended with (dot)", please give an example .. a file name cannot finish by a dot ...!

  13. #13
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: extract name and copy the location

    dear PCI

    like file name (Verification Covering Letter.) above code is not mentioning the location of word files...for excel and pdf files code is working..means i have 3 files of word docx in folder, doc name is showing in column G but location is not showing

    Adeel
    Last edited by adeel1; 02-27-2017 at 03:47 AM.

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

    Re: extract name and copy the location

    Try (untested)
    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: extract name and copy the location

    Dear PCI
    i got it, can we add some like (means) doc and docx (for both in same column) as well under below code, if i want, will it work

    means like

    Please Login or Register  to view this content.
    i made some changes in above code than run this is working for me, just confirm if i will made changes like this any change required in remaining code or this is enough to change here..
    Last edited by adeel1; 02-27-2017 at 04:36 AM.

  16. #16
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: extract name and copy the location

    Yes it is exactly what you have to do: You got it

  17. #17
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: extract name and copy the location

    thanks sir, for your kind help and time

  18. #18
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: extract name and copy the location

    You are welcome

  19. #19
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: extract name and copy the location

    Dear PCI
    just having problem, hope you will help that i put data in behind columns in C,D,E,F and than run last given code for get the location, data of mention column has disappeared, it should not, please amend
    Adeel

  20. #20
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: extract name and copy the location

    Hello adeel1,
    Because you modified the code, it will be good that you attach the last one from you.
    Else you can remove next statement which is cleaning up the sheet
    Please Login or Register  to view this content.

  21. #21
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: extract name and copy the location

    thanks PCI now its good

    Adeel

+ 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. Mac excel 2016, vba copy file from one location to sandbox location
    By sujithy007 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-11-2016, 12:01 PM
  2. Replies: 9
    Last Post: 06-09-2016, 10:28 AM
  3. Need to extract specific but varying length and location numbers from description
    By 5bigun in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-08-2016, 10:39 AM
  4. [SOLVED] Extract Unique List selected by month/year and Location which has 2 different files
    By suchetherrah in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-20-2015, 04:52 AM
  5. Replies: 4
    Last Post: 10-25-2014, 02:34 PM
  6. [SOLVED] Extract variable location data from multiple sheets
    By Aaron_Tram in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 03-22-2013, 05:07 PM
  7. Replies: 4
    Last Post: 08-02-2010, 07:16 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