Access 2007 error when sending email through Outlook 2007

S

Sharon

I send email using this module:
Sub sbSendMessage(argRecipient, argFrom, argSubject, argBody, argUserKey,
argNbrEmail)
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment

Dim tmpRecipient As String
Dim tmpSubject As String
Dim tmpBody As String
Dim tmpFrom As String
Dim tmpUserKey As Long
Dim tmpNbrEmail As Integer



tmpRecipient = argRecipient
tmpSubject = argSubject
tmpBody = argBody
tmpFrom = argFrom
tmpUserKey = argUserKey
tmpNbrEmail = argNbrEmail
On Error GoTo ErrorMsgs

' 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. Substitute
' your names here.
Set objOutlookRecip = .Recipients.Add(tmpRecipient)
objOutlookRecip.Type = olTo
' Add the CC recipient(s) to the message.
' Set objOutlookRecip = .Recipients.Add("Andrew Fuller")

objOutlookRecip.Type = olCC

' Set the Subject, Body, and Importance of the message.
.Subject = tmpSubject
'.Body = tmpBody & vbCrLf & vbCrLf
.Importance = olImportanceHigh 'High importance
.BodyFormat = olFormatHTML
.HTMLBody = tmpBody
' .SenderEmailAddress = tmpFrom
.ReadReceiptRequested = False



' Add attachments to the message.
' If Not IsMissing(AttachmentPath) Then
' Set objOutlookAttach = .Attachments.Add(AttachmentPath)
'End If
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send
End With
Call UpdateTracking(tmpUserKey, tmpNbrEmail)
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
Set objOutlookRecip = Nothing
Set objOutlookAttach = Nothing

Exit Sub

ErrorMsgs:
If Err.Number = "287" Then
MsgBox "You clicked No to the Outlook security warning. " & _
"Rerun the procedure and click Yes to access e-mail " & _
"addresses to send your message. For more information, " & _
"see the document at http://www.microsoft.com/office" & _
"/previous/outlook/downloads/security.asp. "
Else
MsgBox Err.Number & " " & Err.Description
End If
End Sub

It worked until I installed FrontPage 2003. Now I get an 429 ActiveX can't
create object error. Help??????
Sharon
 

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