I usually use redemption for this purpose but in this case it isn't an option.
I'm using late binding for compatibility.
When the code below runs on a non-Exchange platform it works great. It fails on the last line of the code below when using Exchange. (trying to add a recipient prior to resolving (for the purpose of add CCs))
The recipient is unknown to the system at this stage (not in contacts etc)
The error is Error 287, Application-defined or object-defined error
Does one use different libraries/code when using Outlook/Exchange?
Function SendEmail(RecipEmail As String, Subject As String, BBody As String, cc1 As String) As Boolean
On Error GoTo err_SendEmail
Dim olApp As Object
Dim olNS As Object
Dim olRecip As Object
Dim oItem As Object
' Set olApp = CreateObject("Outlook.Application")
' Set olNS = CreateObject("Outlook.Namespace")
Dim tInterval As Integer, signature As String
Dim i, MyFile, MyFile2, SentItemsCounter, CoverLetter, tmpEmail, ErrorLine As Long
If RecipEmail <> "" Then
SentItemsCounter = 0
SendEmail = False
Set olApp = CreateObject("Outlook.Application")
Set olNS = olApp.GetNamespace("MAPI")
Set olRecip = olApp.CreateItem(olRecipient)
Set oItem = olApp.CreateItem(0) 'Create a new message
Set olRecip = oItem.Recipients.Add(RecipEmail)