Hi,
I'm using the Outlook view control and I'm trying to create appointments in it.
My code works fine if only one day is highlighted in the calendar (currently in a month view), but the ".SelectedDate" property is of the type data and can't cope with holding a date range (which is fair enough).
Here's what I've got so far which is triggered when I hit a button after I've highlighted one or more days in the Outlook view control:
Private Sub btnCreateAppointment_Click()
Dim OutlookApp As Outlook.Application
Dim Appointment As Outlook.AppointmentItem
Dim OutlookNms As Outlook.NameSpace
Dim OutlookPST As Outlook.MAPIFolder
Dim OutlookCalendar As Outlook.MAPIFolder
Dim OutlookExplorer As Outlook.Explorer
Set OutlookApp = CreateObject("Outlook.application")
Set OutlookNms = OutlookApp.GetNamespace("MAPI")
Set OutlookPST = OutlookNms.Folders("Archive Folders")
Set OutlookCalendar = OutlookPST.Folders("Calendar")
Set Appointment = OutlookCalendar.Items.Add
Appointment.Subject = "Hello"
Appointment.AllDayEvent = True
Appointment.Body = Me.txtNotes
Appointment.Start = Me.OutlookControl.Object.SelectedDate
'Appointment.Start = "20/09/2011 12:00"
'Appointment.End = "21/09/2011 12:00"
Appointment.Save
I'm struggling to find the right property of the view control that is holding the dates I've selected.
I've tried using Me.OutlookControl.Object.selection.???, but when looking in the locals windows I can't see any properties that are holding the date range.
I don't have a problem creating an appointment that spans several days, just a problem reading in what days have been selected
I'm using the Outlook view control and I'm trying to create appointments in it.
My code works fine if only one day is highlighted in the calendar (currently in a month view), but the ".SelectedDate" property is of the type data and can't cope with holding a date range (which is fair enough).
Here's what I've got so far which is triggered when I hit a button after I've highlighted one or more days in the Outlook view control:
Private Sub btnCreateAppointment_Click()
Dim OutlookApp As Outlook.Application
Dim Appointment As Outlook.AppointmentItem
Dim OutlookNms As Outlook.NameSpace
Dim OutlookPST As Outlook.MAPIFolder
Dim OutlookCalendar As Outlook.MAPIFolder
Dim OutlookExplorer As Outlook.Explorer
Set OutlookApp = CreateObject("Outlook.application")
Set OutlookNms = OutlookApp.GetNamespace("MAPI")
Set OutlookPST = OutlookNms.Folders("Archive Folders")
Set OutlookCalendar = OutlookPST.Folders("Calendar")
Set Appointment = OutlookCalendar.Items.Add
Appointment.Subject = "Hello"
Appointment.AllDayEvent = True
Appointment.Body = Me.txtNotes
Appointment.Start = Me.OutlookControl.Object.SelectedDate
'Appointment.Start = "20/09/2011 12:00"
'Appointment.End = "21/09/2011 12:00"
Appointment.Save
I'm struggling to find the right property of the view control that is holding the dates I've selected.
I've tried using Me.OutlookControl.Object.selection.???, but when looking in the locals windows I can't see any properties that are holding the date range.
I don't have a problem creating an appointment that spans several days, just a problem reading in what days have been selected