如何在 Outlook 中发送会议邀请之前自动计算与会者人数

立即分享:

本文将教您如何利用 Outlook VBA 在发出会议邀请之前自动统计与会者人数。 

类似于在发送电子邮件之前计算收件人数量,一些用户也希望在发送会议邀请之前计算与会者数量。 像往常一样,这旨在估计总的 cost 提议的会议,然后决定是否向与会者发送这样的会议邀请。 此外,由于 Outlook 允许用户将与会者设置为必填或可选,因此有些人希望对不同类型的与会者进行计数。 如果可以包括会议资源和持续时间,那就再好不过了。 虽然 Outlook 没有这种直接的功能,但您仍然可以使用 VBA 代码来实现它。

在您的 Outlook 中发送会议邀请之前自动计算与会者人数

发送会议邀请前自动统计与会者人数

  1. 到tar然后,启动您的 Outlook 程序。
  2. 然后在 Outlook 主窗口中,按“Alt + F11”快捷键。
  3. 接下来就成功进入Outlook VBA编辑器了。 现在您需要找到并打开“ThisOutlookSession”项目。
  4. 随后,将以下 VBA 代码复制并粘贴到该项目中。
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim objMeetingInvitation As Outlook.MeetingItem
    Dim objMeeting As Outlook.AppointmentItem
    Dim objAttendees As Outlook.Recipients
    Dim objAttendee As Outlook.recipient
    Dim lRequiredAttendeeCount, lOptionalAttendeeCount, lResourceCount As Long
    Dim strMsg As String
    Dim nPrompt As Integer
 
    If TypeOf Item Is MeetingItem Then
       Set objMeetingInvitation = Item
       Set objMeeting = objMeetingInvitation.GetAssociatedAppointment(True)
       Set objAttendees = objMeetingInvitation.Recipients
    End If
 
    lRequiredAttendeeCount = 0
    lOptionalAttendeeCount = 0
    lResourceCount = 0
 
    'Count the required & optional attendees and resources, etc.
    For Each objAttendee In objAttendees
         If objAttendee.Type = olRequired Then
            lRequiredAttendeeCount = lRequiredAttendeeCount + 1
         ElseIf objAttendee.Type = olOptional Then
            lOptionalAttendeeCount = lOptionalAttendeeCount + 1
         ElseIf objAttendee.Type = olResource Then
            lResourceCount = lResourceCount + 1
         End If
    Next
 
    'Double check the meeting invitation details
    strMsg = "Meeting Details:" & vbCrLf & vbCrLf & _
     "Required Attendees: " & lRequiredAttendeeCount & vbCrLf & _
     "Optional Attendees: " & lOptionalAttendeeCount & vbCrLf & _
     "Resources: " & lResourceCount & vbCrLf & _
     "Duration: " & GetDuration(objMeeting) & vbCrLf & vbCrLf & _
     "Are you sure to send this meeting invitation?"
 
    nPrompt = MsgBox(strMsg, vbExclamation + vbYesNo, "Double Check Meeting Invitation")
 
    If nPrompt = vbYes Then
       Cancel = False
    Else
       Cancel = True
    End If
End Sub

Function GetDuration(objCurMeeting As AppointmentItem) As String
    'Convert minute to hour
    If objCurMeeting.Duration > 60 Then
       GetDuration = Round(objCurMeeting.Duration / 60, 1) & " hours"
    ElseIf objCurMeeting.Duration = 60 Then
       GetDuration = Round(objCurMeeting.Duration / 60, 1) & " hour"
    ElseIf objCurMeeting.Duration < 60 Then
       GetDuration = objCurMeeting.Duration & " mins"
    End If
End Function

VBA 代码 - 在发送会议邀请之前自动计算与会者人数

  1. 之后,您需要签署此代码。
  2. 稍后确保您的 Outlook 允许数字签名的宏。
  3. 从现在开始,每次点击会议邀请中的“发送”按钮,您都会收到一条消息,显示与会者人数、资源和持续时间,如下图所示:显示与会者人数的消息

灵活应对令人沮丧的前景腐败

也许您以前遇到过 Outlook 问题,例如冻结、各种错误消息等。 幸运的是,Outlook 预装了收件箱修复工具,称为 扫描仪,能够解决小问题。 但如果问题很严重,您将需要重新使用更专业的工具,例如 DataNumen Outlook Repair.

作者简介:

Shirley Zhang 是一位数据恢复专家 DataNumen, Inc.,它是数据恢复技术领域的世界领先者,包括 腐败的中密度纤维板 和 outlook 修复软件产品。 欲了解更多信息,请访问 datanumen.com

立即分享:

评论被关闭。