Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub PrintInvoice()
Dim Res As Long Res = MsgBox("Do you want to print the invoice?", vbQuestion + vbYesNo) Select Case Res Case vbYes On Error Resume Next ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True if err.Number < 0 then _ MsgBox "Error: " & err.Description, vbOK + vbInformation Err.clear On Error goto 0 Case vbNo Exit Sub End Select End Sub Since you don't offer any choices, your msgbox should just show vbOK -- Regards, Tom Ogilvy "Olly" wrote in message om... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Print Error Message: Print titles must be contiguous and complete | Excel Discussion (Misc queries) | |||
Error Message if user leaves a field blank | Excel Worksheet Functions | |||
Counting instances of found text (Excel error? Or user error?) | Excel Worksheet Functions | |||
How to print when an error message keeps showing? | Excel Discussion (Misc queries) | |||
changing the message in an error message | Excel Worksheet Functions |