📊 VBA (Excel)

Report Size of Stuck print spooler files (VBA)

Reports the total size and top-level file count of stuck print spooler files using Scripting.FileSystemObject, straight from Excel VBA.

By WindowsScripting.com · 713 B
SpoolerFilesSizeReport.bas
Attribute VB_Name = "SpoolerFilesSizeReport"
Option Explicit

Public Sub SpoolerFilesSizeReport()
    Dim fso As Object
    Dim folder As Object
    Dim folderPath As String

    folderPath = "C:\Windows\System32\spool\PRINTERS"

    Set fso = CreateObject("Scripting.FileSystemObject")

    If Not fso.FolderExists(folderPath) Then
        MsgBox "Folder not found:" & vbCrLf & folderPath, vbExclamation
        Exit Sub
    End If

    Set folder = fso.GetFolder(folderPath)

    MsgBox "Stuck print spooler files" & vbCrLf & folderPath & vbCrLf & _
           "Size: " & Format(folder.Size / 1048576, "#,##0.00") & " MB" & vbCrLf & _
           "Files (top level): " & folder.Files.Count, vbInformation
End Sub