Outlook PST 파일의 각 색상 범주에 있는 총 항목 수를 빠르게 얻으려면 이 문서에 표시된 VBA 코드를 사용할 수 있습니다. 편리한 확인을 위해 모든 카운트를 Excel 파일로 직접 내보냅니다.
어떤 이유로 Outlook 데이터 파일의 각 색상 범주에 있는 항목 수를 계산해야 하는 경우가 있습니다. 일반적으로 즉시 검색을 사용하여 계산을 수행할 수 있습니다. 예를 들어, 먼저 검색 상자를 클릭하십시오. 그런 다음 "검색" 리본에서 "범주화" 버튼을 클릭하고 드롭다운 목록에서 특정 색상 범주를 선택합니다. 그런 다음 "범위" 리본 그룹에서 "모든 Outlook 항목"을 선택합니다. 나중에 검색이 완료된 후 선택한 색상 범주의 모든 항목이 나열됩니다. 이제 상태 표시줄의 왼쪽 하단 모서리에서 이러한 검색 결과의 수를 볼 수 있습니다.
의심의 여지없이 색상 범주가 많은 경우 이렇게 하면 하나씩 계산하는 것이 매우 지루할 것입니다. 따라서 이 요구 사항에 대한 응답으로 여기에서 훨씬 빠른 방법을 공개합니다. 모든 카운트를 Excel 파일로 바로 내보냅니다.
Outlook의 각 색상 범주에 있는 항목 수를 Excel로 내보내기
- In the first place, start your Outlook application.
- 그런 다음 "Alt + F11"키 버튼을 눌러 Outlook VBA 편집기에 액세스합니다.
- 이어지는 "Microsoft Visual Basic for Applications" 창에서 빈 모듈을 엽니다.
- 다음으로 다음 VBA 코드를 이 모듈 창에 복사할 수 있습니다.
Public objDictionary As Object
Public objExcelApp As Excel.Application
Public objExcelWorkbook As Excel.Workbook
Public objExcelWorksheet As Excel.Worksheet
Sub ExportCountofItemsinEachColorCategories()
Dim objCategories As Object
Dim objCategory As Object
Dim objPSTFile As Outlook.Folder
Dim objFolder As Outlook.Folder
Dim strExcelFile As String
'Create a New Excel file
Set objExcelApp = CreateObject("Excel.Application")
Set objExcelWorkbook = objExcelApp.Workbooks.Add
Set objExcelWorksheet = objExcelWorkbook.Sheets("Sheet1")
objExcelWorksheet.Cells(1, 1) = "Color Category"
objExcelWorksheet.Cells(1, 2) = "Count"
'Find all the color categories
Set objDictionary = CreateObject("Scripting.Dictionary")
Set objCategories = Outlook.Application.Session.Categories
For Each objCategory In objCategories
objDictionary.Add objCategory.Name, 0
Next
Set objPSTFile = Outlook.Application.Session.PickFolder
For Each objFolder In objPSTFile.Folders
ProcessFolder objFolder
Next
'Save the new Excel file
objExcelWorksheet.Columns("A:B").AutoFit
strExcelFile = "E:\Outlook\Color Categories (" & Format(Now, "yyyy-mm-dd_hh-mm-ss") & ").xlsx"
objExcelWorkbook.Close True, strExcelFile
MsgBox "Complete!", vbExclamation
End Sub
Private Sub ProcessFolder(ByVal objCurrentFolder As Outlook.Folder)
Dim objItem As Object
Dim objSubFolder As Object
Dim ArrayCategories As Variant
Dim VarCategory As Variant
Dim ArrayKey As Variant
Dim ArrayItem As Variant
Dim i As Long
Dim nRow As Integer
'Count the items in each color category via Dictionary object
For Each objItem In objCurrentFolder.Items
If objItem.Categories <> "" Then
ArrayCategories = Split(objItem.Categories, ",")
For Each VarCategory In ArrayCategories
If objDictionary.Exists(VarCategory) = True Then
objDictionary.Item(VarCategory) = objDictionary.Item(VarCategory) + 1
End If
Next
End If
Next
ArrayKey = objDictionary.Keys
ArrayItem = objDictionary.Items
nRow = 2
'Input the information into the new Excel file
For i = LBound(ArrayKey) To UBound(ArrayKey)
objExcelWorksheet.Cells(nRow, 1) = ArrayKey(i)
objExcelWorksheet.Cells(nRow, 2) = ArrayItem(i) & “ Items”
nRow = nRow + 1
Next
'Process the subfolders recursively
For Each objSubFolder In objCurrentFolder.Folders
ProcessFolder objSubFolder
Next
End Sub
- 그런 다음 Outlook에서 매크로를 허용하는지 확인하십시오.
- 마지막으로 시도해 볼 수 있습니다.
- 먼저 이 새 매크로에서 F5 키 버튼을 누릅니다.
- 그런 다음 원본 PST 파일을 선택하고 "확인"을 눌러야 합니다.
- "완료"라는 메시지가 표시되면 로컬 드라이브로 이동하여 Excel 파일을 저장하기 위해 미리 정의된 폴더를 열 수 있습니다.
- Excel 파일을 찾아 엽니다. 다음 이미지와 같이 표시됩니다.
Outlook이 갑자기 충돌하는 경우 수행할 작업
Although Outlook comes with multiple powerful features, you will tend to meet various problems in your Outlook with time going on. For instance, Outlook can crash from time to time. At best, restarting Outlook will be able to fix the issue. At worst, it can directly lead to PST data corruption. At that time, you will make use of varying means to PST 수리 파일을 사용하여 최대 Outlook 데이터를 얻을 수 있습니다. DataNumen Outlook Repair.
저자 소개 :
Shirley Zhang은 데이터 복구 전문가입니다. DataNumen, Inc.는 다음과 같은 데이터 복구 기술 분야의 세계적 리더입니다. SQL 수리 및 전망 수리 소프트웨어 제품. 자세한 내용은 WWW.datanumen.COM

