ไปยังเนื้อหาหลัก

จะนับชั่วโมง / วัน / สัปดาห์ที่ใช้ในการนัดหมายหรือการประชุมใน Outlook ได้อย่างไร

สมมติว่ามีการนัดหมายและการประชุมมากมายในปฏิทินใน Outlook และตอนนี้คุณต้องการนับชั่วโมง / วัน / สัปดาห์ที่ใช้ในการนัดหมายและการประชุมเหล่านี้มีความคิดอย่างไร บทความนี้จะแนะนำ VBA เพื่อช่วยคุณ

นับชั่วโมง / วัน / สัปดาห์ที่ใช้ในการนัดหมายหรือประชุมกับ VBA


นับชั่วโมง / วัน / สัปดาห์ที่ใช้ในการนัดหมายหรือประชุมกับ VBA

วิธีนี้จะแนะนำ VBA เพื่อนับชั่วโมงหรือนาทีที่ใช้ในการนัดหมายหรือการประชุมที่ระบุใน Outlook โปรดดำเนินการดังนี้:

1. เลื่อนไปที่โฟลเดอร์ปฏิทินแล้วคลิกเพื่อเลือกการนัดหมายหรือการประชุมที่คุณจะนับชั่วโมงที่ใช้ไป

2 กด อื่น ๆ + F11 คีย์พร้อมกันเพื่อเปิดหน้าต่าง Microsoft Visual Basic for Applications

3 คลิก สิ่งที่ใส่เข้าไป > โมดูลจากนั้นวางโค้ด VBA ด้านล่างลงในหน้าต่างโมดูลการเปิด

VBA: นับชั่วโมง / นาทีที่ใช้ในการนัดหมายหรือการประชุมใน Outlook

Sub CountTimeSpent()
Dim oOLApp As Outlook.Application
Dim oSelection As Outlook.Selection
Dim oItem As Object
Dim iDuration As Long
Dim iTotalWork As Long
Dim iMileage As Long
Dim iResult As Integer
Dim bShowiMileage As Boolean

bShowiMileage = False

iDuration = 0
iTotalWork = 0
iMileage = 0

On Error Resume Next

    Set oOLApp = CreateObject("Outlook.Application")
Set oSelection = oOLApp.ActiveExplorer.Selection

    For Each oItem In oSelection
If oItem.Class = olAppointment Then
iDuration = iDuration + oItem.Duration
iMileage = iMileage + oItem.Mileage
ElseIf oItem.Class = olTask Then
iDuration = iDuration + oItem.ActualWork
iTotalWork = iTotalWork + oItem.TotalWork
iMileage = iMileage + oItem.Mileage
ElseIf oItem.Class = Outlook.olJournal Then
iDuration = iDuration + oItem.Duration
iMileage = iMileage + oItem.Mileage
Else
iResult = MsgBox("Please select some Calendar, Task or Journal items at first!", vbCritical, "Items Time Spent")
Exit Sub
End If
Next

Dim MsgBoxText As String
MsgBoxText = "Total time spent: " & vbNewLine & iDuration & " minutes"

If iDuration > 60 Then
MsgBoxText = MsgBoxText & HoursMsg(iDuration)
End If

If iTotalWork > 0 Then
MsgBoxText = MsgBoxText & vbNewLine & vbNewLine & "Total work recorded; " & vbNewLine & iTotalWork & " minutes"

If iTotalWork > 60 Then
MsgBoxText = MsgBoxText & HoursMsg(iTotalWork)
End If
End If

If bShowiMileage = True Then
MsgBoxText = MsgBoxText & vbNewLine & vbNewLine & "Total iMileage; " & iMileage
End If

    iResult = MsgBox(MsgBoxText, vbInformation, "Items Time spent")

ExitSub:
Set oItem = Nothing
Set oSelection = Nothing
Set oOLApp = Nothing
End Sub

Function HoursMsg(TotalMinutes As Long) As String
Dim iHours As Long
Dim iMinutes As Long
iHours = TotalMinutes \ 60
iMinutes = TotalMinutes Mod 60
HoursMsg = " (" & iHours & " Hours and " & iMinutes & " Minutes)"
End Function

4 กด F5 หรือคลิกปุ่ม วิ่ง เพื่อเรียกใช้ VBA นี้

ตอนนี้กล่องโต้ตอบจะปรากฏขึ้นและแสดงจำนวนชั่วโมง / นาทีที่การนัดหมาย / การประชุมที่เลือกใช้ไป ดูภาพหน้าจอ:

หมายเหตุ: คุณสามารถเลือกการนัดหมายหรือการประชุมหลายรายการในเวลาเดียวกันเพื่อนับชั่วโมง / นาทีทั้งหมดที่ใช้ไปด้วยรหัส VBA นี้


บทความที่เกี่ยวข้อง


สุดยอดเครื่องมือเพิ่มผลผลิตในสำนักงาน

Kutools สำหรับ Outlook - คุณสมบัติอันทรงพลังมากกว่า 100 รายการเพื่อเติมพลังให้กับ Outlook ของคุณ

🤖 ผู้ช่วยจดหมาย AI: ส่งอีเมลระดับมืออาชีพทันทีด้วยเวทมนตร์ AI คลิกเพียงครั้งเดียวเพื่อตอบกลับอย่างชาญฉลาด น้ำเสียงที่สมบูรณ์แบบ การเรียนรู้หลายภาษา เปลี่ยนรูปแบบการส่งอีเมลอย่างง่ายดาย! ...

📧 การทำงานอัตโนมัติของอีเมล: ไม่อยู่ที่สำนักงาน (ใช้ได้กับ POP และ IMAP)  /  กำหนดการส่งอีเมล  /  Auto CC/BCC ตามกฎเมื่อส่งอีเมล  /  ส่งต่ออัตโนมัติ (กฎขั้นสูง)   /  เพิ่มคำทักทายอัตโนมัติ   /  แบ่งอีเมลผู้รับหลายรายออกเป็นข้อความส่วนตัวโดยอัตโนมัติ ...

📨 การจัดการอีเมล์: เรียกคืนอีเมลได้อย่างง่ายดาย  /  บล็อกอีเมลหลอกลวงตามหัวเรื่องและอื่นๆ  /  ลบอีเมลที่ซ้ำกัน  /  การค้นหาขั้นสูง  /  รวมโฟลเดอร์ ...

📁 ไฟล์แนบโปรบันทึกแบทช์  /  การแยกแบทช์  /  การบีบอัดแบบแบตช์  /  บันทึกอัตโนมัติ   /  ถอดอัตโนมัติ  /  บีบอัดอัตโนมัติ ...

🌟 อินเตอร์เฟซเมจิก: 😊อีโมจิที่สวยและเจ๋งยิ่งขึ้น   /  เพิ่มประสิทธิภาพการทำงาน Outlook ของคุณด้วยมุมมองแบบแท็บ  /  ลดขนาด Outlook แทนที่จะปิด ...

???? เพียงคลิกเดียวสิ่งมหัศจรรย์: ตอบกลับทั้งหมดด้วยไฟล์แนบที่เข้ามา  /   อีเมลต่อต้านฟิชชิ่ง  /  🕘 แสดงโซนเวลาของผู้ส่ง ...

👩🏼‍🤝‍👩🏻 รายชื่อและปฏิทิน: แบทช์เพิ่มผู้ติดต่อจากอีเมลที่เลือก  /  แบ่งกลุ่มผู้ติดต่อเป็นกลุ่มแต่ละกลุ่ม  /  ลบการแจ้งเตือนวันเกิด ...

เกิน คุณสมบัติ 100 รอการสำรวจของคุณ! คลิกที่นี่เพื่อค้นพบเพิ่มเติม

 

 

Comments (11)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hallo Amanda,

Vielen Dank für die Rückfrage.

Hier ein Beispiel. Im Kalender werden 2 Termine ausgewählt.

Termin 1:
Gesamtdauer: 2 Stunden
Teilnehmer: A, B, C

Termin 2:
Gesamtdauer: 3 Stunden
Teilnehmer: B, C, D

Ergebnis der Auswertung (Reihenfolge egal):
Gesamtdauer Teilnehmer A: 2 Stunden
Gesamtdauer Teilnehmer B: 5 Stunden
Gesamtdauer Teilnehmer C: 5 Stunden
Gesamtdauer Teilnehmer D: 3 Stunden

Das ganze dann am besten in einer .csv oder excel oder irgendwas was man speichern und bearbeiten kann ;o)

Damit will ich erreichen das ich die Zeiten welche unser Dienstleister mit uns in Terminen verbringt abgleichen kann mit dem was er uns abrechnet. D.h. ich sehe was er sagt was er noch sonst so treibt... oder auch eben nicht ;o)
This comment was minimized by the moderator on the site
Gibt es eine Möglichkeit das MAcro so anzupassen das die Summe der Zeiten je Teilnehmer in den Terminen ermittelt wird? Als Projektmanager bin ich inteessiert zu wissen wieviele Stunden wir mit einme Dienstleister in Terminen verbringen.

Vielen Dank!
This comment was minimized by the moderator on the site
Hi,

Do you mean that you want to get the total number of time across all events that are related with a specific attendee?
I am not quite sure that I understand what you want.

Amanda
This comment was minimized by the moderator on the site
C'est parfait même et surtout pour une analphabète de l'informatique. Merci.
This comment was minimized by the moderator on the site
Can you do the same in OWA?
This comment was minimized by the moderator on the site
What a very helpful macro! Thank you!
This comment was minimized by the moderator on the site
how do you count total time for all meetings on a calendar over a period. We are trying to figure out how much our different staff members are spending in meetings in total.
This comment was minimized by the moderator on the site
You need to change the calendar view to a list view that shows all of the appointments together, and then you can highlight all of those that you're interested in totaling, and run that VBA macro.
This comment was minimized by the moderator on the site
Did you get a response on this or figured it out ? Im trying to do the same.
This comment was minimized by the moderator on the site
I shifted to month mode and selected all invites using drag and drop, able to see the sum of all meetings. hope it helps.
This comment was minimized by the moderator on the site
Thanks for a very useful macro! I just found one error: oItem.Mileage is a String not a Long. This error caused the macro to got blocked.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations