Is a Printer Installed?

When you're using the printer, ensure you don't make the fatal error of presuming your user actually has one.

It doesn't matter whether you’re doing a simple PrintForm or creating a mini word processor that uses the Printer object. If there's no printer, you’re out of luck.

This sneaky code snippet allows you to find out whether a printer is installed.

It works by attempting to retrieve the device name from the Printer object. If an error is registered, there is no printer and PrinterInstalled returns a False. If everything is A-OK, the function returns a True.

Usage

x = PrinterInstalled

Code

Public Function PrinterInstalled() As Boolean

    On Error Resume Next
    
    Dim strDummy As String
    strDummy = Printer.DeviceName
    
    If Err.Number Then
        PrinterInstalled = False
    Else
        PrinterInstalled = True
    End If
    
End Function


Wholesale Products | Wood Blinds | Blinds | Map of Jersey City | Beaded Necklace