我们从前景保留会议室。我们创建会议,并将会议室添加为会议请求中的资源,然后邀请向会议室发送电子邮件邀请,并且会议室接受。我的问题是我想在开会之前添加15分钟的缓冲区。我正在尝试建立一个可在会议设置期间运行的宏,该宏将自动创建15分钟的会议并发送请求。
到目前为止,我已经全部工作了,除了,它没有向会议室发送缓冲会议的邀请。当我进入那个缓冲会议并查看时,它将拉出所有数据,它显示会议室在被邀请的与会者列表中,但实际上并没有发送邀请。我该如何完成?即使涉及到在需要单击“发送”的实际窗口中打开15分钟,我也可以,但是我希望它从主要会议中提取所有数据。以下是我到目前为止的内容。
Public Sub AddTravelTime()
Dim coll As VBA.Collection
Dim obj As Object
Dim Appt As Outlook.AppointmentItem
Dim Travel As Outlook.AppointmentItem
Dim Items As Outlook.Items
Dim Before&, After&
Dim Category$, Subject$
'1. Block minutes before and after the appointment
Before = 30
After = 30
'2. Skip this if the default values never change
Before = InputBox("Minutes before:", , Before)
After = InputBox("Minutes after:", , After)
If Before = 0 And After = 0 Then Exit Sub
'3. Assign this category
Category = "Travel"
Set coll = GetCurrentItems
If coll.Count = 0 Then Exit Sub
For Each obj In coll
If TypeOf obj Is Outlook.AppointmentItem Then
Set Appt = obj
If TypeOf Appt.Parent Is Outlook.AppointmentItem Then
Set Items = Appt.Parent.Parent.Items
Else
Set Items = Appt.Parent.Items
End If
'4. Use the main appointment's subject
Subject = Appt.Subject
Location = Appt.Location
Resources = Appt.Resources
If Before > 0 Then
Set Travel = Items.add
Travel.Subject = Subject
Travel.Location = Location
Travel.Resources = Resources
Travel.Start = DateAdd("n", -Before, Appt.Start)
Travel.Duration = Before
Travel.Categories = Category
Travel.Save
End If
If After > 0 Then
Set Travel = Items.add
Travel.Subject = Subject
Travel.Start = Appt.End
Travel.Duration = After
Travel.Categories = Category
Travel.Save
End If
End If
Next
End Sub
Private Function GetCurrentItems(Optional IsInspector As Boolean) As
VBA.Collection
Dim coll As VBA.Collection
Dim Win As Object
Dim Sel As Outlook.Selection
Dim obj As Object
Dim i&
Set coll = New VBA.Collection
Set Win = Application.ActiveWindow
If TypeOf Win Is Outlook.Inspector Then
IsInspector = True
coll.add Win.CurrentItem
Else
IsInspector = False
Set Sel = Win.Selection
If Not Sel Is Nothing Then
For i = 1 To Sel.Count
coll.add Sel(i)
Next
End If
End If
Set GetCurrentItems = coll
End Function
我很乐意在运行宏时为我创建15分钟的缓冲区,并且还向会议室发送该缓冲区会议的邀请,而不必执行任何其他操作。