Using VBA to creat hyperlinks in an email

Status
Not open for further replies.

udi

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Outlook.com (as MS Exchange)
Hi,

I have a day to day task to send out bug summaries.
The bug summaries are in a specific format: "NNNNN: bug summary".. where NNNNN are the bug number.
In each bug summary i'm creating a hyperlink to the bug page, the link for each bug has the same format:
http://bugs.net/bugs/view.php?id=NNNNN.
The number in the summary and the number in the link are the same.

I want to create a VBA script that will search for the specific text format: "NNNNN: blah blah" and create a hyperlink to the address: http://bugs.net/bugs/view.php?id=NNNNN.
I want this to be done before i'm sending the email.

Is it possible?
Thanks!
udi.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange

udi

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Outlook.com (as MS Exchange)
My searches online didn't produce this info, so thanks a lot!
 

udi

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Outlook.com (as MS Exchange)
I should have mentioned that i'm new to VBA.
With the help of link you provided i found this code:
Sub MailURL()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
Set OuitMail = OutApp.CreateItem(0)
strbody = "<HTML><BODY>"
strbody = strbody & "<A href=http://www.MrExcel.com>URL Text</A>"
strbody = strbody & "</BODY></HTML>"
On Error Resume Next
With OutMail
.To = "APerson@Somewhere.com"
.Subject = "Testing URL"
.HTMLBody = strbody
.Display
'.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub​

Tried to implement the code you suggested as a solution to my problem:
strCode = inputbox ("enter number')
strLinkText= strcode & "Bug summary"
strLink = "http://bugs.net/bugs/view.php?id=" & strCode
objDoc.Hyperlinks.Add objSel.Range, strLink, "", "", strLinkText, ""

my attempts was not successful, i keep getting a compiling error.

i'm kind of lost here..
can you help please?
 
Status
Not open for further replies.
Top