+ Reply to Thread
Results 1 to 22 of 22

How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

  1. #1
    Registered User
    Join Date
    01-30-2015
    Location
    Nashville, TN
    MS-Off Ver
    2010
    Posts
    26

    How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    Hi Folks,

    So here's what I'm looking to do: I want to enter the name of a document into cell A7 for example and have it automatically link to the document named; this way when you click on the text entered, it opens the document like a hyperlink. So essentially I would have document name " Example ", I would type " Example " into cell A7, the text would still say " Example " but it would automatically become a hyperlink to the document. Does anyone know if this is a possibility, and if so, what formula would be necessary? Also, if nothing is entered in A7, I would like for it to remain blank. Any help is great. I'm playing with some formulas myself, and will post any findings. Thanks!

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    So why not select the input cell and use Insert>Hyperlink? With that, you can input the path & filename as the address and, say, just the filename for the display text.
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Registered User
    Join Date
    01-30-2015
    Location
    Nashville, TN
    MS-Off Ver
    2010
    Posts
    26

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    That would be manually entering the hyperlink. Here's my setup: I have a folder containing Associate Dossiers for each associate (Excel files named after the associate i.e. "Doe, John"); I also have Rosters for different locations that reference these files; what I would like to do (for people unfamiliar with creating hyperlinks) is input a formula in say A7 so that all an individual would have to do is type "Doe, John" and it would automatically become a hyperlink to the file while displaying the same text in the same cell. This is for people who have absolutely no experience with Excel...

  4. #4
    Registered User
    Join Date
    01-30-2015
    Location
    Nashville, TN
    MS-Off Ver
    2010
    Posts
    26

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    =IF(A7="","",HYPERLINK("File Pathway"&A7&".xlsx", ""&A7&""))

    If I enter the above formula into any cell but A7, it will automatically create the hyperlink while displaying the text in A7. If I enter it into A7, it displays a circular reference warning then puts a hyperlink 0; when the the text is clicked on, it says it cannot open file. Is there some way we can tweek that basic formula to do what I'm looking to do?

  5. #5
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    Quote Originally Posted by Pheonix843 View Post
    what I would like to do (for people unfamiliar with creating hyperlinks) is input a formula in say A7 so that all an individual would have to do is type "Doe, John" and it would automatically become a hyperlink to the file while displaying the same text in the same cell
    So, instead of these "people who have absolutely no experience with Excel" inserting a hyperlink, you'd have them edit an existing formula? Because that's what they'd have to do if the formula is to be in the cell where they do their input. The only other option would be to have the input done in one cell and a HYPERLINK formula in an adjacent one. For example, in B2:
    =HYPERLINK("C:\Associate Dossiers\" & A2 & ".xlsx",A2)
    where 'Doe, John' is input into A2 and 'C:\Associate Dossiers\' is the path to the file.

  6. #6
    Registered User
    Join Date
    01-30-2015
    Location
    Nashville, TN
    MS-Off Ver
    2010
    Posts
    26

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    I apologize if I'm not clear enough with my questions; I'm not talking about editing the formula. If I type "Doe, John" into A7, A7 then automatically becomes a hyperlink to file "Doe, John" and displays as "Doe, John" as originally typed. That would be what the formula would do. I understand how to create the hyperlink in A8 based upon what's entered in A7, but that's not what I'm looking for. I want all of this to happen automatically within the same cell, and all the user would have to do is type the associate name in the cell. I don't know if that's possible in Excel as is or with Add-Ins, which is why I'm checking on here. Is that a bit clearer? I know I've come across some pretty amazing add-ins, so maybe someone has a solution to bypassing the circular reference error...

  7. #7
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    A FORMULA in the cell you want the users to input text into cannot do that - partly for the reasons you have discovered but mainly because whatever they input into the cell will erase the formula. What you want requires a HYPERLINK. To do that would means using a Worksheet_SelectionChange macro attached to the input worksheet, such as:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    01-30-2015
    Location
    Nashville, TN
    MS-Off Ver
    2010
    Posts
    26

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    Sorry, haven't ventured much into macros yet...I know what they are, but I haven't the faintest idea of how/where to input that code and utilize it. Would be grateful for instructions. Thanks for all your help so far, by the way. I appreciate the time and effort.

  9. #9
    Registered User
    Join Date
    01-30-2015
    Location
    Nashville, TN
    MS-Off Ver
    2010
    Posts
    26

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    Never mind, I found out where and how to properly enter it. The code creates a hyperlink with the entered text, so thank you very much for that. The only problem now is that the hyperlink won't open the file, but I can probably find a problem in the file pathway/wording somewhere. Thank you for your help, and I will post my findings when I can.

  10. #10
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    Coding error -
    Change:
    Address:="C:\Associate Dossiers\" & ActiveCell.Text
    to:
    Address:="C:\Associate Dossiers\" & ActiveCell.Text & ".xlsx"

  11. #11
    Registered User
    Join Date
    01-30-2015
    Location
    Nashville, TN
    MS-Off Ver
    2010
    Posts
    26

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    You are a God among men...Thank you so much for your epic genius. The only thing I'm running into now is that I have to clear the contents of a cell before entering in a different name, otherwise it opens the file of the previous name and throws up a run-time error, but that's not a big deal considering what you've just accomplished for me and hopefully countless others. Thank you again!

  12. #12
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    As written, the macro converts anything input into column A into a hyperlink. I wasn't aware you planned to change the names, rather than just adding new ones. If you want to limit the cells the macro applies to, change "A:A" in the code to something like "A7" for just one cell or "A7:A10" for a limited range of cells. As for clearing the cell contents, if you use the arrow keys on the keyboard to access it, instead of clicking on it with the mouse, you can just overtype whatever is already there.

  13. #13
    Registered User
    Join Date
    01-30-2015
    Location
    Nashville, TN
    MS-Off Ver
    2010
    Posts
    26

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    I made the change to range already, but the cells still need to be cleared by selecting "Clear Contents" otherwise it links the new text to the previous file. Not sure why, but I'm not concerned about that. Like I said, your help and success with this is amazing enough, so thank you. For some reason if I put a name in say A7 and then a name in A8, I can open each of those hyperlinks fine the first time, but if I go back into them, it brings up the Run-time Error '1004': Method 'Intersect' of object '_Global' failed. Currently Googling what that's about. If nothing else, I can protect the macros with a password, removing the debug option, so the user is forced to hit "End" and everything is fine.

  14. #14
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    I'm not seeing either of those issues, so I can't really comment further. Maybe someone else will chime in.

  15. #15
    Registered User
    Join Date
    01-30-2015
    Location
    Nashville, TN
    MS-Off Ver
    2010
    Posts
    26

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    For anyone else tackling this problem or looking for the same info, here's what happens: Enter Associate into A7, click on link, it opens associated file. Enter different Associate into A8, click on link, it opens associated file. If you then click on the link in A7 again, it opens the file but throws up the error "Run-time Error '1004': Method 'Intersect' of object '_Global' failed." It allows you to choose "End", "Debug", and "Help". Choosing "End" closes the error, and all is good. If you choose "Debug", it shows that the error results from the "Intersect(Target, ActiveSheet.Range("A:A")) Is Nothing Then" portion of the macro. If you choose end, and continue opening that same file, it no longer shows the error. However, if you click on the link in A8, it will pull up the file with the error and do the same thing.

  16. #16
    Registered User
    Join Date
    01-30-2015
    Location
    Nashville, TN
    MS-Off Ver
    2010
    Posts
    26

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    Still looking for a solution on my end. Anyone else figured anything out?

  17. #17
    Forum Contributor Toonies's Avatar
    Join Date
    07-30-2009
    Location
    Newcastle, UK
    MS-Off Ver
    Excel 2016
    Posts
    503

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    look at these threads they should point you in the right direction

    http://www.excelforum.com/l/965684-asdf.html


    http://www.excelforum.com/excel-prog...extension.html

  18. #18
    Registered User
    Join Date
    01-30-2015
    Location
    Nashville, TN
    MS-Off Ver
    2010
    Posts
    26

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    Thanks for the response, Toonies. These examples aren't a solution to what I'm looking for. I need to be able to input a file name in A5 and have the hyperlink be placed back into A5; essentially it automatically becomes a hyperlink to the file. The macro code listed earlier in this thread does exactly that, however it has a couple hiccups. That's what I'm looking to solve now: the hiccups.

  19. #19
    Forum Contributor Toonies's Avatar
    Join Date
    07-30-2009
    Location
    Newcastle, UK
    MS-Off Ver
    Excel 2016
    Posts
    503

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    ok try this

    Please Login or Register  to view this content.

  20. #20
    Registered User
    Join Date
    01-30-2015
    Location
    Nashville, TN
    MS-Off Ver
    2010
    Posts
    26

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    And with a few minor alterations to fit actual file paths, we have a winner! You are wonderful! Thank you so much for your help Toonies!

  21. #21
    Registered User
    Join Date
    01-30-2015
    Location
    Nashville, TN
    MS-Off Ver
    2010
    Posts
    26

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    One thing I just noticed for anyone else who might be interested in using this code, in order to change the name in a cell and change the hyperlink location, you have to right-click and clear contents before entering the new name, otherwise it will still jump to the previous file. Not a big deal, but want others to be aware.

  22. #22
    Forum Contributor Toonies's Avatar
    Join Date
    07-30-2009
    Location
    Newcastle, UK
    MS-Off Ver
    Excel 2016
    Posts
    503

    Re: How to Enter Name of File and Automatically Turn It Into Hyperlink to Said File

    Glad I could help, please mark your thread as Solved

+ 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] Auto hyperlink file from specific folder after enter file name in cell
    By satputenandkumar0 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-12-2014, 06:11 AM
  2. Replies: 0
    Last Post: 08-23-2013, 07:57 AM
  3. Automatically hyperlink to file without knowing extension
    By lozoroo in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-24-2013, 10:00 AM
  4. [SOLVED] VBA Code to Enter File Name, Activate the File, and Run Macro on File
    By DHartwig35805 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-09-2012, 03:49 PM
  5. [SOLVED] Hyperlink in excel spreadsheet to email file automatically
    By sparker717 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-15-2006, 06:10 PM
  6. [SOLVED] Why can't I use the Enter key to go to the file in a hyperlink in.
    By Imnotageek in forum Excel General
    Replies: 1
    Last Post: 01-21-2005, 10:06 PM
  7. [SOLVED] Enter Data Into Another Excel File Automatically
    By Morrisg in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-10-2005, 11:06 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