print preview in loop

C

CG Rosen

Hi Group,

Having trouble to get below code to execute as I hoped. If more then one
selection is
made in the listbox I was hoping there was possible to loop true the print
previews and
printout or close the preview, and that next selection should show as print
preview.
I get only this working for one selection, if more the loop stops. Grateful
for some
hints how to get the loop running,

Best regards

CG Rosen

-----------------------------------------------------------------------------------------------------------------

For i = 0 To Me.ListBox1.ListCount - 1

If Me.ListBox1.Selected(i) = True Then

Sheets("print").Cells(6, 2) =
Sheets("Sheet3").Cells((Me.ListBox1.List(i, 4)), 1)
Sheets("print").Cells(7, 2) =
Sheets("Sheet3").Cells((Me.ListBox1.List(i, 4)), 2)

Application.Dialogs(xlDialogPrinterSetup).Show

UserForm1.Hide
Application.Visible = True
ActiveSheet.PrintPreview EnableChanges:=False
Application.Visible = False
UserForm1.Show

End If

Next i
 

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