I am trying to build a button to print two specific sheets, "PS" and "PL" are the name of the worksheets. But before the print I would like to preivew and if the preview is not acceptable then stop executing code. what is happening in the code i have build, if i Xout of the print preview it goes ahead and print anyway. does anyone know how i can stop it from printing if the preview in not acceptable? Below is the code i have so far. thanx
VBA Code:
Private Sub CommandButton4_Click()
Dim PrntRng As Range
Set PrntRng = Application.InputBox("Select Range To Print", "Select Range", Type:=8)
ActiveSheet.PageSetup.PrintArea = PrntRng.Address
Debug.Print PrntRng.Columns.Count
Debug.Print PrntRng.Rows.Count
Sheets(Array("PS", "PL")).PrintPreview
Sheets(Array("PS", "PL")).PrintOut
Sheets("PL").Select
End Sub
Last edited by a moderator: