S
SAC
I'm using this module to send email. The only problem I'm having is that
the sendto string is showing up in the BCC. I've even traced it through and
it looks correct.
Any ideas?
Here it is:
Sub SendMessageNew(strTo As String, strCC As String, strBCC As String,
_
strSubject As String, strBody As String, DisplayMsg As Boolean,
Optional AttachMentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim strRecipTo As String
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(strTo)
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message.
If strCC > "" Then Set objOutlookRecip =
..Recipients.Add(strCC)
objOutlookRecip.Type = olCC
' Add the BCC recipient(s) to the message.
If strBCC > "" Then Set objOutlookRecip =
..Recipients.Add(strBCC)
objOutlookRecip.Type = olBCC
' Set the Subject, Body, and Importance of the message.
.Subject = strSubject
.Body = strBody & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance
' Add attachments to the message.
If Not IsMissing(AttachMentPath) Then
If AttachMentPath > "" Then Set objOutlookAttach =
..Attachments.Add(AttachMentPath)
End If
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
' Should we display the message before sending?
If DisplayMsg Then
.Display
Else
.Save
.Send
End If
End With
Set objOutlook = Nothing
End Sub
Thanks.
the sendto string is showing up in the BCC. I've even traced it through and
it looks correct.
Any ideas?
Here it is:
Sub SendMessageNew(strTo As String, strCC As String, strBCC As String,
_
strSubject As String, strBody As String, DisplayMsg As Boolean,
Optional AttachMentPath)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
Dim strRecipTo As String
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(strTo)
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message.
If strCC > "" Then Set objOutlookRecip =
..Recipients.Add(strCC)
objOutlookRecip.Type = olCC
' Add the BCC recipient(s) to the message.
If strBCC > "" Then Set objOutlookRecip =
..Recipients.Add(strBCC)
objOutlookRecip.Type = olBCC
' Set the Subject, Body, and Importance of the message.
.Subject = strSubject
.Body = strBody & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance
' Add attachments to the message.
If Not IsMissing(AttachMentPath) Then
If AttachMentPath > "" Then Set objOutlookAttach =
..Attachments.Add(AttachMentPath)
End If
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
' Should we display the message before sending?
If DisplayMsg Then
.Display
Else
.Save
.Send
End If
End With
Set objOutlook = Nothing
End Sub
Thanks.