Problem Sending olAppointmentItem

  • Thread starter benyod79 via AccessMonster.com
  • Start date
B

benyod79 via AccessMonster.com

Please take a look at this code. It doesn't seem to want to send the message
after saving it. I have code written to grab email addresses as a string then
call this function. I'm not getting any error messages (except for the normal
automated warnings). I also have a olTaskItem code that works the same,
however I can use the ".assign" to make it send. Is there something along
these lines I'm missing?

Written in Access 2003

Thanks for the help.


Function SendEmail()

'Open instance of Access
Dim olApp As Object
Dim olNs As Object
On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
If Err.Number = 429 Then
Set olApp = CreateObject("Outlook.application")
End If
Set olNs = olApp.GetNamespace("MAPI")

'Create Appointment Item
Dim olApt As AppointmentItem
Set olApt = olApp.CreateItem(olAppointmentItem)
Dim olOptionalAttendance As Outlook.Recipient

Set olOptionalAttendance = olApt.Recipients.Add(Email)
olOptionalAttendance.Resolve

With olApt
.Subject = "Some subject"
.Body = "Some Body"
.MeetingStatus = olMeeting
.BusyStatus = olBusy
.Start = #1/1/2001#
.Duration = 120
.Location = "Some Location"
.Save 'Works Great to here
.Send 'Doesn't not perform this step
End With

On Error GoTo 0

'Clear items and variables
Set olApp = Nothing
Set olNs = Nothing
Set olApt = Nothing
Set olOptionalAttendance = Nothing

End Function
 

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