How to Quickly Print the List of Free Days for a Specific Month in Your Outlook Calendar

If you wish to rapidly get the list of free days for a specific month in your Outlook calendar, you can make use of the method exposed in this article. It can use VBA to print out the list within seconds.

With your Outlook calendar stuff with various appointments and meetings, you may desire to quickly extract a list of free days. Therefore, in the followings, we’ll share a piece of VBA code with you, which is able to find out all the free days in a specific month and print out the list of these free days straightly. Now read on to get the elaborate steps.

Quickly Print the List of Free Days for a Specific Month in Your Outlook Calendar

Print the List of Free Days for a Specific Month in Your Calendar

  1. For a start, launch your Outlook program.
  2. Then, after entering Outlook window, you need to press “Alt + F11” keys.
  3. Next in the subsequent “Microsoft Visual Basic for Applications” window, you can open a blank module.
  4. After that, copy the following VBA code into this module window.
Sub PrintFreeDaysinSpecificMonth()
    Dim strMonth As String
    Dim dFirstDate As Date
    Dim nDay As Integer
    Dim i As Long
    Dim strFreeDays As String
    Dim objAppointments As Outlook.Items
    Dim objFoundAppointment As Outlook.AppointmentItem
    Dim strFilter As String
    Dim objFileSystem As Object
    Dim strTextFile As String
    Dim objTextFile As Object
    'Enter the specific month
    strMonth = InputBox("Enter the month, such as 7 or July:")
    'Get the first date of the specific month in current year
    dFirstDate = CDate(strMonth & " 1, " & Year(Date))
    strFreeDays = "Your Free Days in " & strMonth & ", " & Year(Date) & ":" & vbCrLf & vbCrLf & vbCrLf
    i = 0
    For nDay = 0 To 30
        'Get all appointments in the default Outlook calendar
        Set objAppointments = Application.Session.GetDefaultFolder(olFolderCalendar).Items
        objAppointments.Sort "[Start]"
        objAppointments.IncludeRecurrences = True
        strFilter = "[Start] >= '" & Format(dFirstDate + nDay, "M/D/YYYY") & "' And [Start] < '" & Format(dFirstDate + nDay + 1, "M/D/YYYY") & "'"
        'Find the appointment in each day
        Set objFoundAppointment = objAppointments.Find(strFilter)
        'If there is no appointment in the day
        If objFoundAppointment Is Nothing Then
           i = i + 1
           'Input into the list of free days
           strFreeDays = strFreeDays & i & ": " & Format(dFirstDate + nDay, "M/D/YYYY") & vbCrLf
        End If
    strFreeDays = strFreeDays & vbCrLf & vbCrLf & "You have " & i & " free days in " & strMonth & ", " & Year(Date) & " in total!"
    'Create a new Text file
    Set objFileSystem = CreateObject("Scripting.FileSystemObject")
    strTextFile = "E:\Your Free Days in " & strMonth & " " & Year(Date) & ".txt"
    Set objTextFile = objFileSystem.CreateTextFile(strTextFile, True)
    'Input the list of free days into this Text file
    objTextFile.WriteLine (strFreeDays)
    'Print the Text file
    Shell ("notepad.exe /p " & strTextFile)
    'Delete the Text file
    objFileSystem.DeleteFile (strTextFile)
End Sub

VBA Code - Print the List of Free Days for a Specific Month in Your Outlook Calendar

  1. Later you ought to insure that macros are enabled in your Outlook.
  2. Ultimately, you can try this new macro simply by press F5 key button in this module window.
  3. At once, you’ll be demanded to input the specific month, such as 7 or July.Input Specific Month
  4. Finally, a list of free days in the specified month will be print out. It will look like the following screenshot:List of Free Days for a Specific Month

Watch out for Every Outlook Error

Despite packed with myriad excellent features, errors can occur to Outlook now and then. Thus, you should beware of these errors. Mounting errors can lead to serious Outlook crashes one day. And in the event of crashes, even Scanpst will not be able to rescue your Outlook any more. At that point, your last resort is to employ a well-quality external tool, such as DataNumen Outlook Repair.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including damaged mdf and outlook repair software products. For more information visit

Comments are closed.