+ Reply to Thread
Results 1 to 6 of 6

Hyperlink Renaming

  1. #1
    Registered User
    Join Date
    06-18-2010
    Location
    Dallas
    MS-Off Ver
    Excel 2007
    Posts
    59

    Hyperlink Renaming

    Hello,

    I was wondering if I could get some help with hyperlink validation renaming.

    I currently have this working code:

    Please Login or Register  to view this content.
    What this code does is compare a list of hyperlinks which are named a number of digits to a file name using cells C2 and D2 in combination with the file names listed under col B.
    If the hyperlink is valid, this program will keep the hyperlink active but rename the hyperlink name to "link"
    If the hyperlink does not exist(does not point to a particular picture in the directory), it will disable the hyperlink and change the hyperlink name to "no link"

    I was wondering if there was any way to keep the file name of the hyperlink and if the link does not exist, disable it change the hyperlink font color to black and make it not underlined.
    This way the hyperlinks with photos are distinguished from the files without a photo.

    I currently have the following code to hyperlink the file

    Please Login or Register  to view this content.
    As you can see, I have been naming the hyperlink the contents in B2
    After this hyperlink validation code executes, I would like the contents of the hyperlink to still be named the contents in Col B


    Thanks
    Last edited by vargs; 07-02-2010 at 08:26 AM.

  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: Hyperlink Renaming Problem

    Adding in a new variable to help with your link text in cell B2 as well, this should do it:

    Please Login or Register  to view this content.
    _________________
    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-18-2010
    Location
    Dallas
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: Hyperlink Renaming Problem

    Thanks for the post,

    I tried it out and I seem to be getting an error when i run it saying compile error variable not defined and it then highlights the word "clear"
    but on the upper left hand side it has a left arrow pointing to a colored row that has the text Sub AddHyperlinks()

    thanks

  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: Hyperlink Renaming Problem

    Sorry, my bad:
    Please Login or Register  to view this content.

  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: Hyperlink Renaming Problem

    Also, here's a version that uses the text IN COLUMN B as the link text.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-18-2010
    Location
    Dallas
    MS-Off Ver
    Excel 2007
    Posts
    59

    Re: Hyperlink Renaming Problem

    Thank you so much, the code worked flawlessly.
    I appreciate the help very much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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