How to alert the user with message box that tell them that printer they want to use is offline? I want to print on paper only the printer is online.
Code:Private Sub Command1_Click()
Dim p As Printer
For Each p In Printers
If p.DeviceName = Combo1.Text Then Set Printer = p: Exit For
Next
Printer.Print "this is a test" ' print something
Printer.EndDoc ' finish
End Sub
Private Sub Form_Load()
'Add all the available printers to the combo box
For i% = 0 To Printers.Count - 1
Combo1.AddItem Printers(i%).DeviceName
Next i%
'Display the default printer
For i% = 0 To Combo1.ListCount - 1
If Combo1.List(i%) = Printer.DeviceName Then
Combo1.ListIndex = i%
Exit For
End If
Next i%
End Sub
