Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am putting together a POC for my company regarding some monitoring tools that we use. As part of my project I need to convert portions of a plaintext email sent to me into a hyperlink (I am not able to send the emails in HTML from the tool itself).

I have next to no experience with VB, but this is what I stitched together reading various other posts. I realize it is not functional at all, but I thought it might be something of a baseline for others get a better idea of what I am trying to accomplish and give feedback on. Essentially I am trying to search the email for a string, and convert it into a more concise hyperlink that points to that same string as the url.

I need some help cleaning up what I have if you have any pointers.

Option Explicit

Sub InsertHyperLink(MyMail As MailItem)
Dim body As String, re As Object, match As Variant

body = MyMail.body
Set re = CreateObject("vbscript.regexp")
re.Pattern = "^https\..*Operation>$"

For Each match In re.Execute(body)
    body = Replace(body, match.Value, "<a href=""" & Right(match.Value) & """>Open Link</a>", 1, -1, vbTextCompare)
Next

MyMail.body = body
MyMail.Save
End Sub
share|improve this question
    
What's "not functioning" about it? –  Ƭᴇcʜιᴇ007 Aug 23 '13 at 20:43

1 Answer 1

I have an answer but it's a little bit long winded, I'm sure there's an easier way but this way works:

If you have word go into word and you can make the hyperlink in work and then change font,size etc, you can them copy from word to Outlook and it will keep hyperlink. :D

share|improve this answer
    
Can you elaborate on what that would look like in VB? –  worseone Aug 26 '13 at 17:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.