Question RE Redemption.dll Code

  • Thread starter Thread starter alondon
  • Start date Start date
A

alondon

Jocelyn,

You are certainly "Most Valuable Person". Almost there (I think).

Ok, I downloaded Redemption and installed redemption.dll and referenced its
"SafeOutlookLibrary" (used Tools|Reference as this is not an add-in right?)

Now I have to reference the redemption objects which means changing or
adding to the following code - see highlighted items green is out and red is
in. All very logical, but it doesn't work? Hangs Outlook. So, what is
wrong with my thinking here?

Sub NewMailMessage(thesubject As String, _
theBody As String, _
theAddress As String, _
theAttachment As String, _
theVersionSelected As String)

'Note Outlook Type Library must be referenced

Dim myOutlook As New Outlook.Application
Dim myOutlook As New Redemption.SafeContactItem
Dim newMail As Outlook.MailItem

On Error GoTo ErrorHandler

'Create a new mail message item
Set newMail = myOutlook.CreateItem(olMailItem)
Set newMail = New Redemption.SafeContactItem

With newMail
' **Add the subject of the mail message
.Subject = thesubject
' **Create some body text
.Body = vbCrLf & theBody & vbCrLf & vbCrLf
' **Add a recipient
.Recipients.Add (theAddress)
' **Attach a file
' **.Attachments.Add theAttachment, olByValue, , theVersionSelected
' **Send the mail message
.Send
End With
Exit Sub

ErrorHandler:

'Release memory
MsgBox "Outlook has created an error and your version has not been
sent."
Set myOutlook = Nothing
Set myNameSpace = Nothing
Set newMail = Nothing

End Sub
 
Back
Top