+ Reply to Thread
Results 1 to 16 of 16

Adding A Hyperlink To Excel Generated Email

  1. #1
    Registered User
    Join Date
    03-09-2012
    Location
    Georgia
    MS-Off Ver
    Excel 2003
    Posts
    19

    Adding A Hyperlink To Excel Generated Email

    Pulling my hair out over this one...trying to add a hyperlink into the body of an excel generated email. I've scoured the web but can't find a solution. The code I have here (from Ron de Bruin) works great without any attachments but I would like to add a hyperlink into the body of the email.

    Would greatly appreciate any help with this...


    Please Login or Register  to view this content.
    Last edited by WJO; 03-13-2012 at 04:27 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Adding A Hyperlink To Excel Generated Email

    Hello WJO,

    Adding a hyperlink into an email requires encoding the body into HTML. If you can post how you want the body emailed, I will code it for you and make the needed changes to the macro.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    03-09-2012
    Location
    Georgia
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Adding A Hyperlink To Excel Generated Email

    Quote Originally Posted by Leith Ross View Post
    Hello WJO,

    Adding a hyperlink into an email requires encoding the body into HTML. If you can post how you want the body emailed, I will code it for you and make the needed changes to the macro.

    Thank you so much for helping me. I was trying to get this in the body with a hyperlink below it. If this won't work let me know. The file path is "D:\Documents and Settings\wowen\Jason Owen\CAR's\CAR's Currently Routing" and then I am trying to add the current file name

    Hopefully this makes sense.


    strbody = "Hi " & Cells(FormulaCell.Row, "B").Value & ": " & Cells(FormulaCell.Row, "A") & vbNewLine & vbNewLine & _
    "CAR: " & Range("A5").Value & " From " & Range("B3").Value & " Is Ready For Your Approval " & vbNewLine & vbNewLine & "Click Here To Open"


    Again thanks for your help..

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Adding A Hyperlink To Excel Generated Email

    Hello WJO,

    Is Drive "D" on a server or private computer?

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Adding A Hyperlink To Excel Generated Email

    Hello WJO,

    This should work. Give it a try and me know the results.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-09-2012
    Location
    Georgia
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Adding A Hyperlink To Excel Generated Email

    CAR Electronic Routing7.xls
    Quote Originally Posted by Leith Ross View Post
    Hello WJO,

    This should work. Give it a try and me know the results.
    Please Login or Register  to view this content.


    First of all, thank you. People like you make this an amazing site. Hopefully I'll learn enough some day to be able to help others...

    Tried the code you revised last night. It worked like I described it, it created a hyperlink to the folder which the file resides in. I tried to add a few lines of code (that names a workbook based off a cell value) but it didn't work (either in your encoded HTML code or regular code), and I can't figure out why.

    Here is the code with the few extra lines to name the worksheet off of a cell value. Can you help me figure out why this isn't working. I would like the hyperlink to go directly to the file and not just the folder, as there will be multiple files in the folder.

    I am also attaching a copy of my workbook, which I have worked on for 2 weeks. It is basically a routing list, and it is almost complete except for the fact that one of my macros doesn't work when I hide a group of cells. The "Approve CAR" macro does not work when I hide columns C-H (which are highlighted in yellow). Can you offer any suggestions on how to make this one macro work? I tried to add code to unhide at beginning / hide at end of macro but this didn't work for me.

    Again thanks for your help...

    Please Login or Register  to view this content.

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Adding A Hyperlink To Excel Generated Email

    Hello WJO,

    When the macro runs are you receiving an error or does the workbook not save? If you are receiving an error, what is the error number or description?

  8. #8
    Registered User
    Join Date
    03-09-2012
    Location
    Georgia
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Adding A Hyperlink To Excel Generated Email

    Leith, I get an error:

    Some Error Occurred
    9
    Subscript Out Of Range

    and it specifically highlights this code line in yellow...

    wbName = Sheets("Field Signature Approval").Range("A5").Value

    Does this help?

  9. #9
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Adding A Hyperlink To Excel Generated Email

    Hello WJO,

    Error 9, Subscript out of Range, indicates that Sheets("Field Signature Approval") was not found in the Active Workbook. Check the spelling of the worksheet and make sure there are no extra spaces in the actual sheet name.

    To verify the name, double click the tab on the sheet. This will highlight the name on the tab. You can then copy this to clipboard using Ctrl+C.

    On an Empty Sheet
    1. Paste the copied Tab name into cell A1.
    2. In cell A2 type the name as it should be.
    3. In A3 add this Formula:
      =IF(A1=A2, "OK", "DIFFERENT")

  10. #10
    Registered User
    Join Date
    03-09-2012
    Location
    Georgia
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Adding A Hyperlink To Excel Generated Email

    I did that, and everything checked out ok. I also changed the name to just "Approval", on both the tab and in the code, with the same Error 9 result

  11. #11
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Adding A Hyperlink To Excel Generated Email

    Hello WJO,

    Can you post a copy of the workbook for review?

  12. #12
    Registered User
    Join Date
    03-09-2012
    Location
    Georgia
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Adding A Hyperlink To Excel Generated Email

    Quote Originally Posted by Leith Ross View Post
    Hello WJO,

    Can you post a copy of the workbook for review?
    Absolutely...thanks for looking at it.

    CAR Electronic Routing7.xls

  13. #13
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Adding A Hyperlink To Excel Generated Email

    Hello WJO,

    I have tried many times to get this to fail and have not succeeded. The only other change I made beside the file path was to the Sub "NotApplicable". This was an overly complicated routine.

    Have you tried shutting down your computer and restarting everything? Sometimes memory resources get scrambled and Excel will behave oddly.
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    03-09-2012
    Location
    Georgia
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Adding A Hyperlink To Excel Generated Email

    Thanks again for your time.

    Well, when I remove the lines I added to try and name the workbook, the error goes away. So I'll try a different avenue..

    Please Login or Register  to view this content.
    I hope you don't mind me asking, but my other macro "Approve CAR", it doesn't work when I hide columns C-H. Works fine when cells aren't hidden. Can you suggest a workaround or other idea to make this work?

    Please Login or Register  to view this content.

  15. #15
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Adding A Hyperlink To Excel Generated Email

    Hello WJO,

    The Find method of a Range object will work only if the cells are visible. If the cells are hidden then you will need to loop through the range and check each cell like I did in "NotApplicable".

  16. #16
    Registered User
    Join Date
    03-09-2012
    Location
    Georgia
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Adding A Hyperlink To Excel Generated Email

    Thanks again for your assistance and timely responses. I appreciated and learned a lot. I marked this one solved, as I got the hyperlink you helped me with...

+ 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