Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Outlook Calendar Appointment 1

Status
Not open for further replies.
Sep 12, 2007
45
0
0
US

I am trying to automate the process of creating an Outlook calendar appointment by clicking on a command button placed on an Access Form.

Here is the code for it:
------------------------------------------------------------------------------------------------
Private Sub cmdAddApptToOutlook_Click()
Dim olApp As Outlook.Application
Dim olappt As Outlook.AppointmentItem
Set olApp = CreateObject("Outlook.Application")
Set olappt = olApp.CreateItem(olAppointmentItem)


Set olappt = olApp.CreateItem(1)

With olappt
.Start = Nz(Me.StartDate, vbNullString) & " " & Nz(Me.StartTime, vbNullString)
.Duration = Nz(Me.ApptDuration, 0)
.Subject = Nz(Me.ApptSubject, vbNullString)
.Body = Nz(Me.ApptBody, vbNullString)
.Location = Nz(Me.ApptLocation, vbNullString)

If Me.chkApptReminder = True Then
If IsNull(Me.ReminderMinutes) Then
Forms!frm_ApptForm.ReminderMinutes.Value = 30
End If
.ReminderOverrideDefault = True
.ReminderMinutesBeforeStart = Me.ReminderMinutes
.ReminderSet = True
End If


Set olappt = Nothing
Set olApp = Nothing


MsgBox "Appointment has been Added!", vbInformation

End With


End Sub
---------------------------------------------------------------------------------------------------------------

The code works and even displays the "Appointment has been Added!" message in a couple of seconds after clicking on the command button but no appointment is created in Outlook calendar!

I have tried both early and late binding AND also referenced the Outlook object library in the VBA editor but no appointment is created!

Please help me with this issue. Thank you.
 
Code:
...
End If
[blue]
.Save
[/blue]
Set olappt = Nothing
Set olApp = Nothing
...

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top