Excel VBA - Problem with Closing Print Preview

Joined
Nov 1, 2022
Messages
1
Reaction score
0
Hi Folks,

I am creating an entry form for data in Excel VBA. On one particular form(UserForm5) I have a button that can shows me print preview of a selected range - A1:31 of a particular worksheet - InputSheet. Print preview works fine but every time I click 'close Print Preview' there is an error "Code execution has been interrupted".

Please help me correct this:

Private Sub CommandButton5_Click()
Me.Hide

With Sheets("InputSheet")
Range("A1:I32").PrintPreview
End With


End Sub
 
Back
Top