Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default print preview in loop

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 533
Default print preview in loop

Seems to me you should pull the UserForm1.Show out of the loop.

--
Jim
"CG Rosen" wrote in message
...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Plot Area Automatically Expands in Print and Print Preview Myk D. Charts and Charting in Excel 2 March 12th 09 01:41 PM
First page of Excel sheerepeats in print layout or print preview philfrotonda Excel Discussion (Misc queries) 1 July 12th 07 09:28 PM
Print and Print Preview Graphic Moving Resizing 2007/2003 Adam Rayburn Excel Discussion (Misc queries) 0 April 4th 07 04:18 PM
print preview v page break preview SamB Excel Discussion (Misc queries) 0 November 16th 06 05:09 PM
cell borders that I create dont show on print preview or print scott3435 Excel Discussion (Misc queries) 2 April 6th 06 02:37 AM


All times are GMT +1. The time now is 04:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"