+ Reply to Thread
Results 1 to 13 of 13

Search and open a file that can be pdf,word,jpeg etc

  1. #1
    Registered User
    Join Date
    06-09-2011
    Location
    szczecin
    MS-Off Ver
    Excel 2010
    Posts
    7

    Question Search and open a file that can be pdf,word,jpeg etc

    Hi,

    I am a newbie with macros and trying to learn but it is not easy . What I need to do should be easy but I have no clue how to achieve it.
    We have lots of files (pdf,doc,docx,xls,xlsx,jpeg,png), in folders and subfolders. There are many subfolders in the main folder. It is sometimes hard to find the file we need as we need to click many times until we get to the folder we want and open the file.

    We are keeping a log of the file names in excel sheet. We need to enter the name of the file we want to open in the inputbox in excel sheet and the code will search for the file name we typed in folder and subfolders and open it for us. That is all we need.

    Any help regarding this problem is extremely highly appreciated. Thank you

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Search and open a file that can be pdf,word,jpeg etc

    Hello semos,

    Welcome to the Forum!

    I have a couple of questions:
    Do the file names include the file path?
    Do you want to search a specific folder and all of its subfolders or an entire disk?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    06-09-2011
    Location
    szczecin
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Search and open a file that can be pdf,word,jpeg etc

    Hello Leith,

    Thanks for the warm welcome and prompt reply. You asked

    Do the file names include the file path?
    No, they don't include file paths. They have names like DS041008-8332.pdf or PIxxxxxxxxx and other names.

    Do you want to search a specific folder and all of its subfolders or an entire disk?
    Searching specif folder and subfolders is enough.

    Thank you very much for your help

  4. #4
    Registered User
    Join Date
    06-09-2011
    Location
    szczecin
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Search and open a file that can be pdf,word,jpeg etc

    Bump..............

  5. #5
    Registered User
    Join Date
    06-09-2011
    Location
    szczecin
    MS-Off Ver
    Excel 2010
    Posts
    7

    Unhappy Re: Search and open a file that can be pdf,word,jpeg etc

    Pls. pls, pls isn't no one willing to help ;(

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Search and open a file that can be pdf,word,jpeg etc

    Hi semos

    Please post what you have...show us the log
    We are keeping a log of the file names in excel sheet.
    You indicate
    There are many sub folders in the main folder
    What is the main folder...what are the sub folder names (some of them...for testing purposes...probably doesn't matter).

    Don't know if I can help. Leith Ross gave me some code to do recursive searches...I couldn't find it tonight. I'll look further in the AM.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  7. #7
    Registered User
    Join Date
    06-09-2011
    Location
    szczecin
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Search and open a file that can be pdf,word,jpeg etc

    Hello Jaslake,

    Thx for the reply. The main folder is in user/desktop and called Transactions. Subfolders are dynamic, that is new subfolders are created everyday. Main folder is the only fixed one. I have attached an excel sheet in which you can see the file names. They are in red. Obviously we have many rows of those names. Each file name is unique by the way. I know there was a search function for excel 2003 which could also look into sub folders but they have taken out this option in excel 2007 and 2010 unfortunately.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    06-09-2011
    Location
    szczecin
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Search and open a file that can be pdf,word,jpeg etc

    I need to catch the plane now. Traveling in 3 hours. I will reply back in 12 hours or so. Thx for the help.

  9. #9
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Search and open a file that can be pdf,word,jpeg etc

    Hi semos

    Sorry, I'm color blind. Can't see red. You referenced a Main Folder and sub-folders. Perhaps you can build a tree that depicts the structure.

    Is what you posted the actual log you referenced? If so, how do you currently do this
    We have lots of files (pdf,doc,docx,xls,xlsx,jpeg,png), in folders and subfolders. There are many subfolders in the main folder. It is sometimes hard to find the file we need as we need to click many times until we get to the folder we want and open the file.
    Assuming I COULD see red AND this is the log you referenced, what do you want to happen? Is E3 (PQ040411a) a file? Is H3 (728837-040411a) a file?
    Last edited by jaslake; 06-11-2011 at 11:30 PM.

  10. #10
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Search and open a file that can be pdf,word,jpeg etc


  11. #11
    Registered User
    Join Date
    06-09-2011
    Location
    szczecin
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Search and open a file that can be pdf,word,jpeg etc

    Hi Jasslakee,

    Sorry for not posting the reference for other link. My bad. I am writing this message from the airport, just logged in to see if there was any plane. Took 2 planes, and will take the last one in 35 min. I have a tree actually which i will post it here when i reach hime, Plane is boarding now. Thx again

  12. #12
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Search and open a file that can be pdf,word,jpeg etc

    Hi semos

    I'm not an Administrator nor am I a Moderator. Expect some feedback from them on this issue. In the meantime, reference the cross-post in your original post (post #1).

    I don't believe I'll need the tree...in your cross-post, you told me in which columns the file names reside. I've something that sorta' works. Will share it later today.

  13. #13
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Search and open a file that can be pdf,word,jpeg etc

    Hi semos
    Try the attached. To run the procedure, select a file name in Column E, H, I, J, K or L then mouse click on the "Run Me" button. You'll be presented with a screen that looks like this UserForm.jpg. Double click on one of the files presented and the file will be opened.

    You'll need to change this line of code to the path of your main folder
    Please Login or Register  to view this content.
    in the UserForm Initialize Event.

    Let me know of issues.
    Attached Files Attached Files

+ 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