J
Jan Kronsell
I have an e-mail address in a sheet, and a text in the column to the right
of the address. I use the FollowHyperlink event to trig the following code.
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim olApp As New Outlook.Application
Dim olNewMail As Object
Dim Recep As String
Dim MsgTxt As String
Set olApp = GetObject("Outlook.Application")
Recep = Target.Value
MsgTxt = Target.Offset(0, 1).Value
Set olNewMail = CreateItem(olMailItem)
With olNewMail
.Recipients.Add Recep
.Body = MsgTxt
.Subject = "Automatisk mail"
.ReadReceiptRequested = False
.OriginatorDeliveryReportRequested = False
.Save
.Display
End With
End Sub
This opens an Outlook mailitem, with the recipeint from one column and the
text from the other ad it suposed to. The problem is, that the clicking the
hyperlink also performs its normal operation, that is opening a mailitem,
with only the recipient. Is there a way to cancel the orginal event and only
use my code? Of course I can use another event, but unfortunately the users
wants click on the mail address as they are used to.
Jan
of the address. I use the FollowHyperlink event to trig the following code.
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Dim olApp As New Outlook.Application
Dim olNewMail As Object
Dim Recep As String
Dim MsgTxt As String
Set olApp = GetObject("Outlook.Application")
Recep = Target.Value
MsgTxt = Target.Offset(0, 1).Value
Set olNewMail = CreateItem(olMailItem)
With olNewMail
.Recipients.Add Recep
.Body = MsgTxt
.Subject = "Automatisk mail"
.ReadReceiptRequested = False
.OriginatorDeliveryReportRequested = False
.Save
.Display
End With
End Sub
This opens an Outlook mailitem, with the recipeint from one column and the
text from the other ad it suposed to. The problem is, that the clicking the
hyperlink also performs its normal operation, that is opening a mailitem,
with only the recipient. Is there a way to cancel the orginal event and only
use my code? Of course I can use another event, but unfortunately the users
wants click on the mail address as they are used to.
Jan