Advertisement
ASP_Volume2 Miscellaneous #33663

Change selected printer

Temporarily change the currently selected (default) printer within your VB program

AI

KI-Zusammenfassung: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Quellcode
original-source
Public Function SetDefaultPrinter(ByVal DeviceName As String) As Boolean
Dim prThis As Printer
If Printers.Count > 0 Then
  '\\ Iterate through all the installed printers
  For Each prThis In Printers
    '\\ If the desired one is found
    If prThis.DeviceName = DeviceName Then
      Set Printer = prThis
      SetDefaultPrinter = True
      '\\ Stop searching
      Exit For
    End If
  Next prThis
End If
End Function
Originalkommentare (3)
Wiederhergestellt von der Wayback Machine