Merrion
12-03-2001, 04:19 AM
Public Function SetDefaultPrinter(ByVal DeviceName As String) As Boolean
Dim prThis As Printer
If Printers.Count > 0 Then
'\\ Iterate through the installed printers
For Each prThis In Printers
'\\ If it is the desired printer
If prThis.DeviceName = DeviceName Then
'\\ set it to be the default printer
Set Printer = prThis
'\\ indicate that the printer was found
SetDefaultPrinter = True
'\\ and stop searching
Exit For
End If
Next prThis
End If
End Function
Dim prThis As Printer
If Printers.Count > 0 Then
'\\ Iterate through the installed printers
For Each prThis In Printers
'\\ If it is the desired printer
If prThis.DeviceName = DeviceName Then
'\\ set it to be the default printer
Set Printer = prThis
'\\ indicate that the printer was found
SetDefaultPrinter = True
'\\ and stop searching
Exit For
End If
Next prThis
End If
End Function