+ Reply to Thread
Results 1 to 6 of 6

Need A Macro That Automaticly searches files in desktop to find .dwg file to hyperlink too

  1. #1
    Registered User
    Join Date
    06-09-2015
    Location
    Ardmore, Oklahoma
    MS-Off Ver
    MS Office 2007
    Posts
    3

    Need A Macro That Automaticly searches files in desktop to find .dwg file to hyperlink too

    Hello, I am trying to figure out a macro that can take a set document that I already have in excel with 20,000 specific numbers that will correspond to .dwg drawings with the same number for the name, that are in my desktop and run it so that it goes through each number in each row in the specific cell column ( excel column B).


    If that's not clear, I'm simply trying to search my computer and have it notice that ((in terms of what I want the computer to think) "Hey in this row that I'm supposed to go down and check, there is a .dwg file name that corresponds with this name in this row of the column, so ill just ask the user if this is the correct file and then I'll automatically link it."

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need A Macro That Automaticly searches files in desktop to find .dwg file to hyperlink

    Wouldn't all the .DWG files be located in the same reference folder, a known location on your system? So you would only need to construct the link using the known path and the name of the actual file?

    If A1 had the word "cat" and you wanted a hyperlink in B1 to cat.dwg in the known path: "C:\MyDesktop\MyFiles", the the HYPERLINK formula in B1 in a simple concatenation:

    =HYPERLINK("C:\MyDesktop\MyFiles\" & A1 & ".dwg", "Link")


    Once you get the first formula working, you should be able to just copy that formula down as needed and all the needed links will be constructed dynamically.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    06-09-2015
    Location
    Ardmore, Oklahoma
    MS-Off Ver
    MS Office 2007
    Posts
    3

    Re: Need A Macro That Automaticly searches files in desktop to find .dwg file to hyperlink

    The only problem with that, (I should have mentioned this in the post) is that my files are located in different folders, there's a folder for a unit, and a type, and so forth. It has to go through many different folders to find the dwg that I would need. And every number has a different corresponding dwg file, so if I copied and that formula all the way down would it keep the cell the same, and simply hyperlink it, leaving the number completely the same?

    Thank you for your help.

  4. #4
    Registered User
    Join Date
    06-09-2015
    Location
    Ardmore, Oklahoma
    MS-Off Ver
    MS Office 2007
    Posts
    3

    Re: Need A Macro That Automaticly searches files in desktop to find .dwg file to hyperlink

    Also considering that there are over 20,000 dwg files to search for, I am not quite sure what path to use on each piece of equipment since they are all located in different folders

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need A Macro That Automaticly searches files in desktop to find .dwg file to hyperlink

    Really? There's no organization to how DWG files are stored in comparison to what they are for? It's truly a random search?

    If a row of data includes information like UNIT, TYPE and "so forth", all of that can be used to construct a given path through those known variables.

    Column B = "filename"
    Column C = "Unit"
    Column D = "Type"
    Column E = "So Forth"

    Then you concatenate all those values together to create a path through your organized structure"

    =HYPERLINK("C:\MainFolder\" & C2 & "\" & D2 & "\" & E2 & "\" & B2 & ".dwg", "Link")


    Hopefully you get the idea here.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need A Macro That Automaticly searches files in desktop to find .dwg file to hyperlink

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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 for saving a worksheet to desktop by any user of the file
    By Hardup in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-30-2014, 07:17 AM
  2. Replies: 1
    Last Post: 08-08-2014, 06:10 AM
  3. [SOLVED] Macro to open folder on desktop and certain files within
    By hutch94 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-05-2014, 11:01 AM
  4. How to save as file on desktop with macro
    By slearner1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-05-2013, 11:35 AM
  5. [SOLVED] Hyperlink Code only works when file saved on desktop
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2005, 03:05 PM

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