取得預設的打印機及設置預設的打印機 Public Function DefaultPrinter(Optional PrinterName As String = vbNullString) As Variant If PrinterName = vbNullString Then DefaultPrinter = Printer.DeviceName Else For Pin = 0 To Printers.Count - 1 If UCase(Printers(Pin).DeviceName) = UCase(PrinterName) Then Dim Ofs As IWshNetwork_Class Set Ofs = New IWshNetwork_Class Ofs.SetDefaultPrinter (PrinterName) DefaultPrinter = True Exit For Else DefaultPrinter = False End If Next End If End Function |
联系客服