Microsoft Word - User gets an error when they choose 'cancel' and don't answer question generated by macro
Asked By Charlene Quinlan on 18-Oct-12 04:56 PM
I have the following code:
Private Sub CommandButton5_Click()
Dim Copies As String
Copies = InputBox("Enter number of copies to print (Word will use your default printer)")
ActiveDocument.PrintOut Range:=wdPrintRangeOfPages, Copies:=Copies, Pages:="17-19", PageType:=w
End Sub
If the user enters a digit it works. If they choose cancel, they get an error and telling them the value is out of range and the debugger starts.
Is there an easy fix?