跳到主要內容

如何在Outlook中按月對電子郵件進行分組和排序?

默認情況下,電子郵件在Outlook的“收件箱”中按接收日期排序。 但是,沒有命令按接收月份對所有電子郵件進行排序或分組。 在這裡,我將介紹一種在Outlook中按月對所有電子郵件進行分組和排序的方法。

使用VBA代碼在Outlook中按月對電子郵件進行分組或排序


使用VBA代碼在Outlook中按月對電子郵件進行分組或排序

此方法將指導您創建一個名為“月”的新列,然後應用VBA宏將收到的月提取到新列中,然後您可以按Outlook中的“月”列對所有電子郵件進行排序或分組。

1.  打開一個郵件文件夾,您將在其中按月對電子郵件進行排序或分組,然後單擊 查看設置 上的按鈕 瀏覽 選項卡在Outlook 2010及更高版本中。

doc按第1個月排序電子郵件

注意: 在Outlook 2007中,您可以單擊 瀏覽 > 目前來看 > 自定義當前視圖.

2。 即將來臨 高級視圖設置/自定義視圖 對話框中,單擊 按鈕(或 字段 按鈕)。

doc按第2個月排序電子郵件

3。 在裡面 顯示列/字段 對話框中,單擊 新列 按鈕(或 新場 按鈕)以打開“新建列/字段”對話框,鍵入 每月 ,在 姓名 盒子,保持 文本 同時選擇 類別 盒子和 格式 框,然後單擊 OK 按鈕。 請參見下面的屏幕截圖:

doc按第3個月排序電子郵件

4.  現在您回到 顯示列/字段 對話框,單擊以選擇 每月 中的項目 顯示這些列 字段) 按此順序 框,然後將其移到 收到 通過點擊 提前 按鈕,最後點擊 OK 按鈕。

doc按第4個月排序電子郵件

5。 點擊 OK 按鈕關閉 高級視圖設置/自定義視圖 對話框。

6。 選擇打開的文件夾中的所有電子郵件,選擇任何電子郵件,然後按 按Ctrl + A 鍵同時。

備註:如果 閱讀面板 正在開啟,請點擊 瀏覽 > 閱讀面板 > 關閉.

7。 打開 Microsoft Visual Basic for Applications 按下 其他 + F11 同時鍵入,然後單擊 插入 > 模塊.

8。 將以下VBA宏粘貼到模塊中:

VBA:按月對電子郵件進行排序或分組

Sub ListSelectionMonth()
	Dim aObj As Object
	Dim oProp As Outlook.UserProperty
	Dim sMonth
	
	On Error Resume Next
	
	For Each aObj In Application.ActiveExplorer.Selection
		Set oMail = aObj
		
		sMonth = Month(oMail.ReceivedTime)
		Set oProp = oMail.UserProperties.Add("Month", olText, True)
		oProp.Value = sMonth
		oMail.Save
		
		Err.Clear
	Next
	
End Sub

9。 按 F5 運行此VBA宏的關鍵。

10。 現在,每個電子郵件的接收月份都提取到以下內容中 每月 柱。 要按月在此打開的文件夾中對所有電子郵件進行排序,只需單擊 每月。 看截圖:

doc按第5個月排序電子郵件

備註:要按月將所有電子郵件分組到此打開文件夾中,請右鍵單擊的列標題 每月,然後選擇 按此字段分組 從右鍵單擊菜單中。 看截圖:

doc按第6個月排序電子郵件


最佳辦公生產力工具

Kutools for Outlook - 超過 100 種強大的功能可增強您的 Outlook

🤖 人工智慧郵件助手: 具備人工智慧魔力的即時專業電子郵件——一鍵天才回覆、完美語調、多語言掌握。輕鬆改變電子郵件! ……

📧 電子郵件自動化: 外出(適用於 POP 和 IMAP)  /  安排發送電子郵件  /  發送電子郵件時按規則自動抄送/密件副本  /  自動轉送(進階規則)   /  自動添加問候語   /  自動將多收件者電子郵件拆分為單獨的訊息 ...

📨 電子郵件管理: 輕鬆回憶電子郵件  /  按主題和其他人阻止詐騙電子郵件  /  刪除重複的電子郵件  /  進階搜索  /  合併資料夾 ...

📁 附件專業版批量保存  /  批量分離  /  批量壓縮  /  自動保存   /  自動分離  /  自動壓縮 ...

🌟 介面魔法: 😊更多又漂亮又酷的表情符號   /  使用選項卡式視圖提高 Outlook 工作效率  /  最小化 Outlook 而不是關閉 ...

👍 一鍵奇蹟: 使用傳入附件回覆全部  /   反網路釣魚電子郵件  /  🕘顯示寄件者的時區 ...

👩🏼‍🤝‍👩🏻 通訊錄和行事曆: 從選定的電子郵件中大量新增聯絡人  /  將聯絡人群組拆分為各組  /  刪除生日提醒 ...

超過 100特點 等待您的探索! 按此處了解更多。

閱讀更多       免費下載      購買
 

 

Comments (14)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I have Outlook 2007 and have try that VBA. First I did have the problem that only 1 E-Mail of all get the month show.
I needed to mark all E-Mails first and then push in VBA F5 to show in all E-Mails the month.

a bad part of that code is that all month (1, 2, 3, 4, 5, 6, 7, 8, 9) get grouped on the wrong position in front of 10, 11, 12
is there any additional VBA sequence what add to the first 9 Month a 0? ergo 01, 02, 03 etc?

as I have several years in some folders it make sense to group those E-Mails first by year and after that by Month.
This comment was minimized by the moderator on the site
Strange.
Made a restart. Now it works.Sorry for bothering.
Thx again :) <3
This comment was minimized by the moderator on the site
Sorry. Didn't saw that the page is origin in english. #emabarrased
Google translate is getting better. :D
Hello from Hamburg,
great stuff. Thanks for this. :)
Only a small problem.
I had first adapted the code so that it puts the year and month together for me.

Sub ListSelectionYearMonth()
Dim aObj As Object
Dim oProp As Outlook.UserProperty
Dim oMail As Object
Dim sMonth
Dim sYear
Dim sYearMonth

On Error Resume Next

For Each aObj In Application.ActiveExplorer.Selection
Set oMail = aObj

sMonth = Month(oMail.ReceivedTime)
sYear = Year(oMail.ReceivedTime)

If sMonth < 10 Then
sMonth = 0 & sMonth
Else
sMonth = sMonth
End If

sYearMonth = sYear & "/" & sMonth
Set oProp = oMail.UserProperties.Add("YearMonth", olText, True)
oProp.Value = sYearMonth
oMail.Save

Err.Clear
Next

End Sub

This worked wonderfully.
Now I noticed in a folder that a grouping first by year and then by month increases the clarity.
I used the original code.
However, the column there remains empty.

Sub ListSelectionMonth()
Dim aObj As Object
Dim oProp As Outlook.UserProperty
Dim oMail As Object
Dim sMonth

On Error Resume Next

For Each aObj In Application.ActiveExplorer.Selection
Set oMail = aObj

sMonth = Month(oMail.ReceivedTime)

If sMonth < 10 Then
sMonth = 0 & sMonth
Else
sMonth = sMonth
End If

Set oProp = oMail.UserProperties.Add("Month", olText, True)
oProp.Value = sMonth
oMail.Save

Err.Clear
Next

End Sub

I'm a bit perplexed at the moment.

Glad about any advice

VG
Armin


Translated with http://www.DeepL.com/Translator (free version)
This comment was minimized by the moderator on the site
Hallo aus Hamburg,super Sache. Danke dafür. :)Kleines Problem nur.Ich hatte zuerst den Code so angepasst das er mir Jahr und Monat zusammensetzt.
Sub ListSelectionYearMonth()
Dim aObj As Object
Dim oProp As Outlook.UserProperty
Dim oMail As Object
Dim sMonth
Dim sYear
Dim sYearMonth

On Error Resume Next

For Each aObj In Application.ActiveExplorer.Selection
Set oMail = aObj

sMonth = Month(oMail.ReceivedTime)
sYear = Year(oMail.ReceivedTime)

If sMonth < 10 Then
sMonth = 0 & sMonth
Else
sMonth = sMonth
End If

sYearMonth = sYear & "/" & sMonth
Set oProp = oMail.UserProperties.Add("JahrMonat", olText, True)
oProp.Value = sYearMonth
oMail.Save

Err.Clear
Next

End Sub

Hat wunderbar geklappt.Nun ist mir in einem Ordner aufgefallen das eine Gruppierung zuersnach Jahr und dann nach Monat die Übersichtlichkeit noch erhöht.Habe als den ursprünglichen Code genommen.Dort bleibt dann allerdings die Spalte leer.
Sub ListSelectionMonth()
Dim aObj As Object
Dim oProp As Outlook.UserProperty
Dim oMail As Object
Dim sMonth

On Error Resume Next

For Each aObj In Application.ActiveExplorer.Selection
Set oMail = aObj

sMonth = Month(oMail.ReceivedTime)

If sMonth < 10 Then
sMonth = 0 & sMonth
Else
sMonth = sMonth
End If

Set oProp = oMail.UserProperties.Add("Monat", olText, True)
oProp.Value = sMonth
oMail.Save

Err.Clear
Next

End Sub

Macht mich grad etwas ratlos.
Freue mich über jeden Rat
VGArmin
This comment was minimized by the moderator on the site
This will also help.
This comment was minimized by the moderator on the site
The code works as in the article. But it does not apply to new letters. Every time you need to go to the created module in the Visual Basik and press F5.
This comment was minimized by the moderator on the site
I used the above vba and let me begin by saying this does help in micro management which is not available by default. this is beneficial for archival and storage and not something supposed to work automatically for incoming email. I was able to modify this a bit and also add a year column. So for all emails I was able to get a month and year so that I can group and then regroup (by year and then by month). What I did find however is there is some kind of limitation to the number of items it goes through and then exists (not sure why). For example if I were to select a folder with 18k-19k emails, it will loop only through some and then at the end of the run it will not update all the emails with the required. However if you run in smaller batches then it runs perfectly fine. The painful part here is to keep on selecting in batches. This is a pain for people like me who wish to manage or rather arrange years or emails that runs in a 6 figures in numbers. Anyone here been able to figure this out out or willing to go on a troubleshooting spree to fix this or how this can be addressed ?
This comment was minimized by the moderator on the site
That is, I want to group mails by subject and put the group with maximum mails on the top. How can I do that?
This comment was minimized by the moderator on the site
I want to :

1. Group mails by subject

2. Sort them by number of e-mails inside the group

How can I do achieve this?
This comment was minimized by the moderator on the site
I want this too
This comment was minimized by the moderator on the site
Is it possible to create VBA macro to group and sort emails by week?
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations