P
Paul Access VBA
Hi, I am using vba with Access 2007 to add appointments to an Outlook 2007
Calendar. This is working fine when I add the appointment to the main
Outlook calendar. However, I have 4 different calendars in the one Outlook,
and I want to be able to choose which outlook calendar I add the appointment
to. Can you tell me how to choose which calendar the appointment will go to?
thanks for your help! (If this isn't the correct forum for this, please let
me know which one is) thanks-Paul
The code I'm using currently is below.
On Error GoTo Add_Err
'Save record first to be sure required fields are filled.
DoCmd.RunCommand acCmdSaveRecord
'Exit the procedure if appointment has been added to Outlook.
If Me!AddedToOutlook = True Then
MsgBox "This appointment is already added to Microsoft Outlook"
Exit Sub
'Add a new appointment.
Else
Dim objOutlook As Outlook.Application
Dim objAppt As Outlook.AppointmentItem
Dim objRecurPattern As Outlook.RecurrencePattern
Set objOutlook = CreateObject("Outlook.Application")
Set objAppt = objOutlook.CreateItem(olAppointmentItem)
With objAppt
..start = Me![Date to Arrive] & " " & #9:00:00 AM#
..Duration = 1920
..Subject = Me.Last__First
..body = Me!Notes
End With
Set objAppt = Nothing
End If
Me!AddedToOutlook = True
MsgBox "Appointment Added!"
Exit Sub
Add_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Exit Sub
Calendar. This is working fine when I add the appointment to the main
Outlook calendar. However, I have 4 different calendars in the one Outlook,
and I want to be able to choose which outlook calendar I add the appointment
to. Can you tell me how to choose which calendar the appointment will go to?
thanks for your help! (If this isn't the correct forum for this, please let
me know which one is) thanks-Paul
The code I'm using currently is below.
On Error GoTo Add_Err
'Save record first to be sure required fields are filled.
DoCmd.RunCommand acCmdSaveRecord
'Exit the procedure if appointment has been added to Outlook.
If Me!AddedToOutlook = True Then
MsgBox "This appointment is already added to Microsoft Outlook"
Exit Sub
'Add a new appointment.
Else
Dim objOutlook As Outlook.Application
Dim objAppt As Outlook.AppointmentItem
Dim objRecurPattern As Outlook.RecurrencePattern
Set objOutlook = CreateObject("Outlook.Application")
Set objAppt = objOutlook.CreateItem(olAppointmentItem)
With objAppt
..start = Me![Date to Arrive] & " " & #9:00:00 AM#
..Duration = 1920
..Subject = Me.Last__First
..body = Me!Notes
End With
Set objAppt = Nothing
End If
Me!AddedToOutlook = True
MsgBox "Appointment Added!"
Exit Sub
Add_Err:
MsgBox "Error " & Err.Number & vbCrLf & Err.Description
Exit Sub