devxlogo

SelectPrinter – Setting the application’s default printer

SelectPrinter – Setting the application’s default printer

' Set the printer with the input name as the default printer for *this ' application* (not for the whole system)Function SelectPrinter(ByVal printer_name As String) As Boolean    Dim i As Integer    SelectPrinter = False    For i = 0 To Printers.Count - 1        ' if the specified printer is found, select it and return True        If Printers(i).DeviceName = printer_name Then            Set Printer = Printers(i)            SelectPrinter = True            Exit For        End If    Next iEnd Function

devx-admin

Share the Post: