View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Olly[_3_] Olly[_3_] is offline
external usenet poster
 
Posts: 10
Default Asking user to print and error message

I am trying to crate some code that asks the user if they want to
print and if the computer encounters an error because there is no
printer installed. How can I adapt my code bellow to allow this to
happen?

Sub PrintInvoice()
Dim Res As Long
Res = MsgBox("Do you want to print the invoice?", vbQuestion +
vbYesNo)
Select Case Res
Case vbYes
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Dim Res As Error
Cas Error("1004")
MsgBox "Error: No print has been found on your
system", vbOKCancel + vbInformation
Case vbNo
Exit Sub
End Select
End Sub

Thanks
Olly