none
Hyperlink alias in Access vba RRS feed

  • Question

  • I am creating the body copy and subject line for an email in a sub which sends this to a generic public sub that creates the email as an Outlook mail item where the body copy is put into the .body property.

    In the initial sub, the body copy includes a marker <detail1> that is replaced using the Replace function with the hyperlink. This is declared as a string and set: hypWebPage = "http://www.AWebsite.org.uk/AWebpage.htm" This all flows through fine and the hyperlink is active in the final email body.

    However I would like to set an alias for the hyperlink. i.e. Please click here rather than please click http://www.AWebsite.org.uk/AWebpage.htm. Can this be done in the initial sub?

    Wednesday, June 12, 2013 8:23 PM

All replies

  • Can't that be done with HTML in the HTMLbody? So it would look something like: .HTMLBody =  "<a href=" & Chr(34) & "http://www.AWebsite.org.uk/AWebpage.htm" &
    Chr(34) & ">Click here</a>"
    Wednesday, June 12, 2013 8:54 PM
  • Thank you for your reply KMickey.

    I'm not sure if that can work here. The public sub used to create the email is passed text for it's .body property from several different subs. The text that is passed sometimes includes a hyperlink within the text and sometimes not. Indeed soemtimes there is more than one hyperlink. I did wonder if I could pass the all the text as a variable wrapped up in the <a href= ...... </a> sort of like this:

    emailbody = "A load of text <a href=http://www.AWebsite.org.uk/AWebpage.htm >click here</a> a load more text"

    However there is quite a lot of text and lots of other complex data to be passed and this seems seems overly complex if there is a way of passing the hyperlink already set with an alias.

    Wednesday, June 12, 2013 9:51 PM