Need help with hardware, software, etc etc, or have some good info you would like to share. Post here.
Moderator: Guardians Knights
by Yemiry » Fri May 19, 2017 5:28 am
hi,
You may use VBA codes to do that .
And I find a link which may be closed to what you want, see below
https://www.datanumen.com/blogs/auto-count-attendees-sending-meeting-invitation-outlook/And I also attach the code here in case that the link may be invalid in the future
- Code: Select all
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
Good luck!
-
Yemiry
- Peasant(newbie)
-
- Posts: 1
- Joined: Fri May 19, 2017 5:22 am
- Gender:
Return to Computer Tech
Who is online
Users browsing this forum: ClaudeBot [Bot] and 0 guests