I am very new to this so please be gentle. I am using outlook 2010 and I need a vba script to automatically locate and action the first hyperlink in an email. I can use the outlook mailbox rules to select this script but I cannot write it. Any help will be appreciated
I was given this but it only opens URL's in the email but not the first hyperlink
Sub LaunchURL(itm As MailItem)
Dim bodyString As String
Dim bodyStringSplitLine
Dim bodyStringSplitWord
Dim splitLine
Dim splitWord
bodyString = itm.Body
bodyStringSplitLine = Split(bodyString, vbCrLf)
For Each splitLine In bodyStringSplitLine
bodyStringSplitWord = Split(splitLine, " ")
For Each splitWord In bodyStringSplitWord
If Left(splitWord, 7) = "http://" Then
Shell ("C:\Program Files\Internet Explorer\IEXPLORE.EXE" & " " & splitWord)
End If
Next
Next
Set itm = Nothing
End Sub
Private Sub test()
Dim currItem As MailItem
Set currItem = ActiveInspector.currentItem
LaunchURL currItem
End Sub