Outlook VBA를 통해 특정 날짜 범위의 모든 바쁜 약속 목록을 인쇄하는 방법

지금 공유 :

이 문서에서는 "바쁨"으로 표시되고 특정 날짜 범위에 예약 된 모든 약속 목록을 쉽게 인쇄 할 수있는 방법을 알려줍니다.

특정 날짜 범위의 모든 바쁜 약속을 찾기 위해 모든 달력을 반복하는 것은 매우 쉽습니다. 검색 범위를 "모든 일정 항목"으로 설정할 수 있습니다. 그런 다음 "시간 표시"가 "바쁨"과 같고 특정 시간 내에있는 약속을 검색합니다.tart 날짜 및 종료 날짜. 그러나 이런 식으로 찾은 약속을 인쇄하고 "파일"> "인쇄"로 이동하면 "메모 스타일"만 사용할 수 있음을 알 수 있습니다. 이는 목록에서 찾은 약속을 인쇄 할 수 없음을 의미합니다. 따라서 이러한 약속 목록을 인쇄하려면 다음 방법을 사용할 수 있습니다.

찾은 약속에 사용할 수있는 메모 스타일 만

특정 날짜 범위의 모든 바쁜 약속 목록 인쇄

  1. 처음에 "Alt + F11"을 통해 Outlook VBA 편집기를 시작합니다.
  2. 그런 다음 "Microsoft Visual Basic for Applications"팝업 창에서 "MS Excel Object Lib"에 대한 참조를 추가합니다.rary "에 따라"개체 라이브러리를 추가하는 방법rary VBA의 참조".
  3. 그 후 다음 VBA 코드를 모듈에 넣으십시오.
Dim dStart, dEnd As Date
Dim objExcelApp As Excel.Application
Dim objExcelWorkbook As Excel.Workbook
Dim objExcelWorksheet As Excel.Worksheet

Sub PrintListOfAllBusyAppointments()
    Dim objStore As Store
    Dim objFolder As Folder
 
    dStart = InputBox("Enter the start date:", , Date)
    dEnd = InputBox("Enter the end date:", , Date + 30)
 
    Set objExcelApp = CreateObject("Excel.Application")
    Set objExcelWorkbook = objExcelApp.Workbooks.Add
    Set objExcelWorksheet = objExcelWorkbook.Sheets(1)
    objExcelApp.Visible = True
 
    With objExcelWorksheet
         .Cells(1, 1) = "Subject"
         .Cells(1, 1).Font.Bold = True
         .Cells(1, 2) = "Location"
         .Cells(1, 2).Font.Bold = True
         .Cells(1, 3) = "Start"
         .Cells(1, 3).Font.Bold = True
         .Cells(1, 4) = "End"
         .Cells(1, 4).Font.Bold = True
         .Cells(1, 5) = "In Folder"
         .Cells(1, 5).Font.Bold = True
    End With
 
    For Each objStore In Application.Session.Stores
        For Each objFolder In objStore.GetRootFolder.Folders
            If objFolder.DefaultItemType = olAppointmentItem Then
               Call ProcessFolders(objFolder)
            End If
        Next
    Next
 
    objExcelWorksheet.Columns("A:E").AutoFit
    objExcelWorksheet.PrintOut
    objExcelWorkbook.Close False
    objExcelApp.Quit
End Sub

Sub ProcessFolders(ByVal objCurFolder As Folder)
    Dim strFilter As String
    Dim objItems As Outlook.Items
    Dim objRestrictedItems As Outlook.Items
    Dim objAppointment As AppointmentItem
    Dim nLastRow As Integer
    Dim objSubFolder As Folder
 
    Set objItems = objCurFolder.Items
    objItems.IncludeRecurrences = True
    objItems.Sort "[Start]"
 
    'Get the appointments in the specific date range
    strFilter = "[Start] >= " & Chr(34) & dStart & " 00:00 AM" & Chr(34) & " AND [End] <= " & Chr(34) & dEnd & " 11:59 PM" & Chr(34)
    Set objRestrictedItems = objItems.Restrict(strFilter)

    For Each objAppointment In objRestrictedItems
        If objAppointment.BusyStatus = olBusy Then
           nLastRow = objExcelWorksheet.Range("A" & objExcelWorksheet.Rows.Count).End(xlUp).Row + 1
 
           With objExcelWorksheet
                .Range("A" & nLastRow) = objAppointment.Subject
                .Range("B" & nLastRow) = objAppointment.Location
                .Range("C" & nLastRow) = objAppointment.Start
                .Range("D" & nLastRow) = objAppointment.End
                .Range("E" & nLastRow) = objCurFolder.FolderPath
           End With
        End If
    Next

    'Process all subfolders recursively
    If objCurFolder.Folders.Count > 0 Then
       For Each objSubFolder In objCurFolder.Folders
           Call ProcessFolders(objSubFolder)
       Next
    End If
End Sub

VBA 코드-특정 날짜 범위의 모든 바쁜 약속 목록 인쇄

  1. 나중에 첫 번째 서브 루틴을 클릭하고 "F5"키 버튼을 누릅니다.
  2. 다음으로 약속을 검색 할 날짜 범위를 지정해야합니다.날짜 범위 지정
  3. 그런 다음 "확인"을 클릭하여 매크로를 계속합니다.
  4. 마지막으로 매크로가 완료되면 아래 스크린 샷과 같이 모든 달력 폴더에 미리 정의 된 날짜 범위의 바쁜 약속 목록이 인쇄됩니다.특정 날짜 범위의 모든 바쁜 약속의 인쇄 된 목록

방해가되는 Outlook 부패 문제 해결

Outlook이 항상 부적절한 방식으로 닫히면 나중에 많은 문제가 발생할 수 있습니다. 그중 Outlook 파일이 손상되는 것이 최악입니다. 데이터 손실을 원하지 않는 경우 다음과 같은 PST 수정 도구를 사용해야합니다. DataNumen Outlook Repair. 최대 데이터를 가져올 수 있습니다. 손상된 Outlook 파일.

저자 소개 :

Shirley Zhang은 데이터 복구 전문가입니다. DataNumen, Inc.는 다음과 같은 데이터 복구 기술 분야의 세계적 리더입니다. SQL 수정 및 전망 수리 소프트웨어 제품. 자세한 내용은 WWW.datanumen.COM

지금 공유 :

댓글이 닫혀있다.