+ Reply to Thread
Results 1 to 15 of 15

Automatically insert hyperlinks to list of file

  1. #1
    Forum Contributor
    Join Date
    07-06-2007
    Posts
    101

    Automatically insert hyperlinks to list of file

    Hi there
    I have a list of file names in a column A header “Audio Files”. The files listed in this column are stored in the same directory but in a different folder called “Audio”.

    And there is another list of file names in column B “Image Files”. The files listed in this column are stored in the same directory but in a different folder called “Images”.

    I would like to be able to automatically loop through these file names and insert a hyperlink to appropriate file where first 20 characters of the file names match with first 20 characters of the name of the files stored in these two folder. The number of files and file names change every day.

    Can someone please help me with this? Let me know if doesn’t make sense, I can try to explain this with some sample spreadsheet.

    Thanks in advance
    gsrai
    Last edited by gsrai31; 07-28-2010 at 07:49 AM.

  2. #2
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Automatically insert hyperlinks to list of file

    Quote Originally Posted by gsrai31 View Post
    Hi there
    I have a list of file names in a column A header “Audio Files”. The files listed in this column are stored in the same directory but in a different folder called “Audio”.

    And there is another list of file names in column B “Image Files”. The files listed in this column are stored in the same directory but in a different folder called “Images”.

    I would like to be able to automatically loop through these file names and insert a hyperlink to appropriate file where first 20 characters of the file names match with first 20 characters of the name of the files stored in these two folder. The number of files and file names change every day.

    Can someone please help me with this? Let me know if doesn’t make sense, I can try to explain this with some sample spreadsheet.

    Thanks in advance
    gsrai
    Hi gsrai,

    Maybe try this:

    What this will do is take the two folders and create hyperlinks to all the files in both folders and Place your AUDIO files in Col A and your Image files in Col B . You will need to change the path to where your files are located.

    Place this code in ThisWorkbook

    Please Login or Register  to view this content.
    Then place this code below in a Module.

    Please Login or Register  to view this content.
    Let me know if you need further assistance.

    Thank You, Mike

  3. #3
    Forum Contributor
    Join Date
    07-06-2007
    Posts
    101

    Re: Automatically insert hyperlinks to list of file

    Hi Mike

    Thanks for looking into this. I have looked into my problem in a little more detail and now I have attached a dummy file (excel 2003) so that I can be bit more specific about what I am trying to achieve. In the attached file in column AG, image files that are stored in “Images” folder are already listed. So I would like these files names changed to hyperlinks so that by clicking on a file name a particular image file from images folder can be opened. In Audio folder there are a number of files that associate with these image files. These file names are not listed in any of the columns but first 20 characters of audio file names are exactly the same as Image file names. In column AJ, I would like to have matching audio files listed so where first 20 characters of audio file name matches with first 20 characters of Image files. And then insert hyperlinks to these files so that user can click on an audio file name column AJ and open the audio file. Hope this is slightly clearer. I should have been more specific in my first request. Thank you again for your help.
    gsrai
    Attached Files Attached Files
    Last edited by gsrai31; 07-18-2010 at 01:28 PM.

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

    Re: Automatically insert hyperlinks to list of file

    In AL1, put the path to the IMAGES folder including the final \. Then use this formula in AJ2, copied down:

    =HYPERLINK($AL$1 & $AG2, "Link")

    I don't know how to activate links to partial filenames for the audio.
    _________________
    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!)

  5. #5
    Forum Contributor
    Join Date
    07-06-2007
    Posts
    101

    Re: Automatically insert hyperlinks to list of file

    Jerry, thanks for this. I did manage link the file using hyperlink function. The reason I added this part to my ealier request for help was that to automate the complete process using one macro. Hopefully Mike or someone else should be able help with this. Thanks for looking into this for me.
    regards, gsrai

  6. #6
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Automatically insert hyperlinks to list of file

    Quote Originally Posted by gsrai31 View Post
    Jerry, thanks for this. I did manage link the file using hyperlink function. The reason I added this part to my ealier request for help was that to automate the complete process using one macro. Hopefully Mike or someone else should be able help with this. Thanks for looking into this for me.
    regards, gsrai
    Hi, I may just be missing what you want to do. However see if this works some what and we can go from there.
    Anyway...
    I changed your file and added the script. You will only need to change these 2 lines below in order to map them to your folders. This will place hyperlinks to each file that is listed in each of your 2 folders.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    07-06-2007
    Posts
    101

    Re: Automatically insert hyperlinks to list of file

    Excellent! I had a quick look, and it appears to do almost everything I wanted to achieve.

    Couple of issues, each hyperlink I click on, I get a message saying “hyperlink can be harmful to your computer….etc, do you want to continue?” Can this be disabled somehow?

    Link to Image files: Another issue, it’s probably my fault that I have not understood my data properly, a link to an image file needs to be to a file that has exactly the same name as it appears in column AG.

    Link to Audio files: Now I also realise that correct audio files are not being linked as my assumption that first 20 characters of a file name are same. Actually, the link to an audio file will need to be to a file that has same name as column AG, up to the dot, and then add _1.wav. So if I were to put a link manually I will use this formula. =HYPERLINK(path&"\"&LEFT(AG2,(FIND(".",AG2,1))-1)&"_1.wav")

    Also rather then changing the path to file in the code, can it be typed as values in two cells in the spreadsheet and code can automatically pick up images and audio folder names from these cell values.

    Hope I have managed to explain this properly. Thank you again for your help.

    Best Regards, gsrai

  8. #8
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Automatically insert hyperlinks to list of file

    Hi Again,

    Here is some information on your hyperlink problem message
    http://support.microsoft.com/kb/829072

    As far as Path in cells you could try this in your code...

    In BB1 and BB2 Enter your path to your files EXAMPLE:
    "C:\Documents and Settings\ME\Desktop\Audio"
    Then Just Copy this and replace what you have currently in Module1 for these 3 Subs below.

    Please Login or Register  to view this content.
    Keep me posted.

    Thank You, Mike
    Last edited by shg; 07-21-2010 at 03:08 PM. Reason: deleted quote

  9. #9
    Forum Contributor
    Join Date
    07-06-2007
    Posts
    101

    Re: Automatically insert hyperlinks to list of file

    Hi Mike
    Thank you for looking into this again for. The bit about having folder in B1 and B2 works fine now. The only issue is that it's not linking the correct image and audio files. These two bits need sorting out -

    Link to Image files: a link to an image file needs to be to a file that has exactly the same name as it appears in column AG.

    Link to Audio files: I realised that correct audio files are not being linked as my assumption that first 20 characters of a file name are same was not correct. Actually, the link to an audio file will need to be to a file that has same name as image file name in column AG, up to the dot before file extension, and then add _1.wav. So if I were to put a link manually I will use this formula. =HYPERLINK(path&"\"&LEFT(AG2,(FIND(".",AG2,1))-1)&"_1.wav")

    Hope you or someone else be able to help me with these two issues.

    Thank you for your help.

    Best Regards
    gsrai

  10. #10
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Automatically insert hyperlinks to list of file

    Here you go, Lets see if we are any closer with this. Remember to follow the link in my other post to fix the issue with the error message when you open a link.

    Keep me posted.

    Thank You, Mike
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    07-06-2007
    Posts
    101

    Re: Automatically insert hyperlinks to list of file

    Hi Mike

    Perfect !! I had a quick look, and it appeared to work exaclty the way I wanted it to.
    Thank you very much for your help with this.

    Best Regards
    gsrai

  12. #12
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Automatically insert hyperlinks to list of file

    Hi Gsrai,


    You are welcome,glad I could help so If everything is working correctly please mark your thread as Solved:

    Here How...
    Click the Edit button on your first post in the thread, Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes.

    If more than two days have elapsed, the Edit button will not appear -- ask a moderator to mark it.

    Thank You, Mike

  13. #13
    Forum Contributor
    Join Date
    07-06-2007
    Posts
    101

    Re: Automatically insert hyperlinks to list of file

    Hi Mike, thank you for reminding me. Before I mark this thread solved, can you please help me with one more thing. The code you provided inserts hyperlink to complete path to each image and audio file. Is it possible to change the full path to "Link to Image" or "Link to Audio" text? thank you again.
    Best Regards
    gsrai

  14. #14
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Automatically insert hyperlinks to list of file

    Hi,

    Maybe this will do what you need.

    Thank You, Mike
    Attached Files Attached Files

  15. #15
    Forum Contributor
    Join Date
    07-06-2007
    Posts
    101

    Re: Automatically insert hyperlinks to list of file

    Hi Mike

    This is exactly what I wanted. Thank you very much for all your help.
    I will mark this thread solved now. Best wishes.

    Regards
    gsrai31

+ 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