staticbob
Well-known Member
- Joined
- Oct 7, 2003
- Messages
- 1,079
Guys,
I have this code that uses redemption to send a mail from Excel.
Problem is, I need the savepath (in body of message, bottom of code) to show as a hyperlink in the sent message. This works fine if Outlook Mail format is set to rich text. If its set to plain text or HTML the hyperlink doesn't work.
How can I control the mail format of this message alone in code ? Some of our users have dynamic HTML signatures, I don't want to change the setting in outlook as this will disbale them.
Thanks,
Bob
I have this code that uses redemption to send a mail from Excel.
Problem is, I need the savepath (in body of message, bottom of code) to show as a hyperlink in the sent message. This works fine if Outlook Mail format is set to rich text. If its set to plain text or HTML the hyperlink doesn't work.
How can I control the mail format of this message alone in code ? Some of our users have dynamic HTML signatures, I don't want to change the setting in outlook as this will disbale them.
Thanks,
Bob
Code:
Public Sub sendemail(savepath, docname)
On Error GoTo errorlog
'Declarations
Dim appOutlook As Object
Dim mi As Object
Dim Created As Boolean
Dim safeitem As Object
'Generate mail item
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
myNameSpace.Logon
Set safeitem = CreateObject("Redemption.SafeMailItem") 'Create an instance of Redemption.SafeMailItem
'Set myFolder = myNameSpace.GetDefaultFolder(olFolderOutbox)
Set mi = myOlApp.CreateItem(olMailItem)
safeitem.Item = mi
'mi.Display
If Created Then appOutlook.Quit
'Get the names for document type from given range
Select Case docname
Case "RFI"
Set rng = Worksheets("email").Range("P4:P25")
Case "CVI"
Set rng = Worksheets("email").Range("Q4:Q25")
Case "SI"
Set rng = Worksheets("email").Range("R4:R25")
Case "Call Off"
Set rng = Worksheets("email").Range("S4:S25")
Case "Requisition"
Set rng = Worksheets("email").Range("T4:T25")
Case "Notice"
Set rng = Worksheets("email").Range("U4:U25")
Case Else
MsgBox "No e-mail addresses"
Exit Sub
End Select
'Scan through the range and verify each name
For Each cell In rng.Cells
If cell.Value <> "" Then
Set Rcp = safeitem.Recipients.Add(cell.Value)
'If Not Rcp.Resolve Then
' Rcp.Delete
Else
End If
Next cell
'Get info and send mail
With safeitem.Item
.subject = Worksheets("directory").Range("B3").Value & " - Workbook Notification"
.Body = "This message has been generated automatically." & vbNewLine & vbNewLine & _
"A new " & docname & " has been created in this location. Please click the link to view . . ." & vbNewLine & vbNewLine & _
"<" & savepath & ">"
End With
safeitem.send
Set mi = Nothing
If Created Then appOutlook.Quit
Set appOutlook = Nothing
Exit Sub