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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top