+ Reply to Thread
Results 1 to 9 of 9

checking file exists before adding hyperlink

  1. #1
    Registered User
    Join Date
    02-21-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    3

    checking file exists before adding hyperlink

    I have the following code:
    Please Login or Register  to view this content.

    Which attaches a hyperlink to the selected cells using cell contents are filename.

    What i now need to add is code to make it check if the file exists first before adding the hyperlink. If the file is not there then the hyperlink should not be added ie leave cell contents as is.

    Can someone please advise me?
    Last edited by arlu1201; 02-22-2013 at 04:04 AM.

  2. #2
    Registered User
    Join Date
    02-21-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: checking file exists before adding hyperlink

    hi,

    i have tried both iffileexists and the DIR functions but cant quite get it to work.
    Please Login or Register  to view this content.
    The contents of the cells are just hyperlinked regardless of whether the file is present.

    Any ideas of what i am doing wrong would be very much appreciated.

    Many thanks,
    Last edited by arlu1201; 02-22-2013 at 04:37 AM.

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: checking file exists before adding hyperlink

    Hi, TaliKL,


    Please Login or Register  to view this content.
    Ciao,
    Holger
    Last edited by arlu1201; 02-22-2013 at 04:37 AM.
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    02-21-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: checking file exists before adding hyperlink

    sorry for breaking the rules.

    i tried to delete the post but couldnt see how. Plz feel free to delete it for me. in the meantime i have corrected my post with the correct formatting.

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: checking file exists before adding hyperlink

    Hi, TaliKL,

    you´re welcome. Thanks for adding the code-tags. If I remember correctly you may only delete a post if no answer has been issued to it (so it must be the opening post in a thread).

    Hope you got the problem fully solved.

    Ciao,
    Holger

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: checking file exists before adding hyperlink

    TaliKL,

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. If you need more information on how to use them, check my signature below this post.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  7. #7
    Registered User
    Join Date
    03-02-2013
    Location
    San Diego
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: checking file exists before adding hyperlink

    Hello, just joined the forum, 2nd time posting, please be easy...
    I took a stab at trying to adapt this to create a hyperlink to a file that begins with a prefix established 1 cell to the left, and a path established 3 cells to the left.
    Looks liks I'm getting an error trying to define Path and Prefix?
    Also, probably skipped a couple steps to get here, but how do I run this script (basically want to create hyperlinks down the whole column)
    Thank you!

    Please Login or Register  to view this content.
    Last edited by arlu1201; 03-02-2013 at 06:26 AM.

  8. #8
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: checking file exists before adding hyperlink

    Hi, skalumba,

    Welcome to the Forum.

    Unfortunately your post does not comply with Rule 2 of our Forum RULES. Do not post a question in the thread of another member -- start your own thread.

    If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread.

    Old threads are often only monitored by the original participants. New threads not only open you up to all possible participants again, they typically get faster response, too.

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code in [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here.

    Ciao,
    Holger

  9. #9
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: checking file exists before adding hyperlink

    Thank you Hahobe.

    Skalumba,

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. If you need more information on how to use them, check my signature below this post.

+ 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