I am trying to make my Database automatically update Outlook calendar appointments, but I can' get it right, have been struggeling for weeks now so some help would be very much appreciated, here is the VBA code I have so far:
Dim appOutLook As Outlook.Application
Dim olMAPI As Outlook.NameSpace
Dim Folder As Outlook.MAPIFolder
Dim colItems As Outlook.Items
Dim appointment As Outlook.AppointmentItem
If Me!AddedToOutlook = True Then
MsgBox "This appointment is already added to Microsoft Outlook"
Exit Sub
Else
Set appOutLook = CreateObject("Outlook.Application"
Set olMAPI = GetObject("", "Outlook.Application".GetNamespace("MAPI"
Set Folder = olMAPI.Folders("Trond Strøm".Folders("Kalender"
Set appointment = appOutLook.CreateItem(olAppointmentItem)
With appointment
.Start = Me!ApptDate & " " & Me!ApptTime
.Duration = Me!ApptLength
.Subject = Me!Appt
If Not IsNull(Me!ApptNotes) Then .Body = Me!ApptNotes
If Not IsNull(Me!ApptLocation) Then .Location = Me!ApptLocation
If Me!ApptReminder Then
.ReminderMinutesBeforeStart = Me!ReminderMinutes
.ReminderSet = True
End If
.Save
End With
Set appointment = Nothing
End If
Set objOutlook = Nothing
Me!AddedToOutlook = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Appointment Added!"
Set appOutLook = Nothing
Set objNameSpace = Nothing
Set objfolder = Nothing
Help very much appreciated
sincerly
Trond Strom
Dim appOutLook As Outlook.Application
Dim olMAPI As Outlook.NameSpace
Dim Folder As Outlook.MAPIFolder
Dim colItems As Outlook.Items
Dim appointment As Outlook.AppointmentItem
If Me!AddedToOutlook = True Then
MsgBox "This appointment is already added to Microsoft Outlook"
Exit Sub
Else
Set appOutLook = CreateObject("Outlook.Application"
Set olMAPI = GetObject("", "Outlook.Application".GetNamespace("MAPI"
Set Folder = olMAPI.Folders("Trond Strøm".Folders("Kalender"
Set appointment = appOutLook.CreateItem(olAppointmentItem)
With appointment
.Start = Me!ApptDate & " " & Me!ApptTime
.Duration = Me!ApptLength
.Subject = Me!Appt
If Not IsNull(Me!ApptNotes) Then .Body = Me!ApptNotes
If Not IsNull(Me!ApptLocation) Then .Location = Me!ApptLocation
If Me!ApptReminder Then
.ReminderMinutesBeforeStart = Me!ReminderMinutes
.ReminderSet = True
End If
.Save
End With
Set appointment = Nothing
End If
Set objOutlook = Nothing
Me!AddedToOutlook = True
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Appointment Added!"
Set appOutLook = Nothing
Set objNameSpace = Nothing
Set objfolder = Nothing
Help very much appreciated
sincerly
Trond Strom