View Single Post
  #4  
Old January 27th 08, 09:32 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Redemption, Help with selecting E-mail Account

Run regsvr32 on Redemption.dll, then try your code.

I'd use something like this:

' previous code

Dim oNS As Outlook.NameSpace

Set OutApp = CreateObject("Outlook.Application")
Set oNS = OutApp.GetNameSpace("MAPI")
oNS.Logon
Set OutMail = OutApp.CreateItem(0)

For Each cell In ThisWorkbook.Sheets("Mail") _
.Columns("BA").Cells.SpecialCells(xlCellTypeConsta nts)
If cell.Value Like "?*@?*.?*" Then
strto = strto & cell.Value & ";"
End If
Next
strto = Left(strto, Len(strto) - 1)

With Destwb
.SaveAs TempFilePath & TempFileName & FileExtStr,
FileFormat:=FileFormatNum

On Error Resume Next

Set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = oNS.MAPIOBJECT

Set Account = Session.Accounts("123 Reporting")
.Account = Account

With OutMail
.To = ""
.CC = ""
.BCC = strto
.Subject = ThisWorkbook.Sheets("Mail").Range("A1").Value
.Body = ""
.Attachments.Add Destwb.FullName
.ReadReceiptRequested = True
.Importance = 1
.DeferredDeliveryTime =
ThisWorkbook.Sheets("Mail").Range("B1").Value

.Save

Dim sID As String
sID = .EntryID
End With


Set Msg = Session.GetItemFromID(sID)
Msg.Account = Account

.Subject = .Subject

.Save

.Send
End With

'rest of the code


Ads