Я знаю, что с VBA вы можете добавлять встречи в календарь outlook с установленной датой и временем в коде, но все, что я хотел бы сделать, это добавить встречу в мой календарь между 7:00 и 9:30 в выбранный день.,Можно ли использовать VBA для выбранного дня и сделать так, чтобы статус также отсутствовал?
Я нашел следующий код, но это добавляет событие к выбранному времени, а не к конкретному времени в выбранный день.:
Sub CreateAppointmentUsingSelectedTime()
Dim datStart As Date
Dim datEnd As Date
Dim oView As Outlook.view
Dim oCalView As Outlook.CalendarView
Dim oExpl As Outlook.Explorer
Dim oFolder As Outlook.folder
Dim oAppt As Outlook.AppointmentItem
Const datNull As Date = #1/1/4501#
' Obtain the calendar view using
' Application.ActiveExplorer.CurrentFolder.CurrentView.
' If you use oExpl.CurrentFolder.CurrentView,
' this code will not operate as expected.
Set oExpl = Application.ActiveExplorer
Set oFolder = Application.ActiveExplorer.CurrentFolder
Set oView = oExpl.CurrentView
' Check whether the active explorer is displaying a calendar view.
If oView.ViewType = olCalendarView Then
Set oCalView = oExpl.currentView
' Create the appointment using the values in
' the SelectedStartTime and SelectedEndTime properties as
' appointment start and end times.
datStart = oCalView.SelectedStartTime
datEnd = oCalView.SelectedEndTime
Set oAppt = oFolder.items.Add("IPM.Appointment")
If datStart <> datNull And datEnd <> datNull Then
oAppt.Start = datStart
oAppt.End = datEnd
End If
oAppt.Display
End If
End Sub
ура