outlook email - sendTo in CC

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.
 
J

Jim/Chris

Can you give the sting you are using when you call the
function "SendmessageNew" .

Jim
 
S

SAC

Here it is:

Private Sub Command12_Click()
'On Error GoTo Err_Command12_Click

'*********** Please Note
Me!Text0 is the TO email address

If IsNull(Me!Text2) Then Text2 = ""
If IsNull(Me!Text4) Then Text4 = ""
If IsNull(Me!Text6) Then Text6 = ""
If IsNull(Me!Text8) Then Text8 = ""
If IsNull(Me!Text10) Then Text10 = ""

SendMessageNew Me!Text0, Me!Text2, Me!Text4, Me!Text6, Me!Text8, True,
Me!Text10

Exit_Command12_Click:
Exit Sub

Err_Command12_Click:
MsgBox Err.Description
Resume Exit_Command12_Click

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top