PDA

View Full Version : print preview



lior03
07-08-2006, 08:23 AM
hello
the following macro preform very well.it count items in a list & set printing orders for the page .how can i make excel print a preview througe a vba code so i can see what i doen.
application.ScreenUpdating = False
ActiveSheet.DisplayRightToLeft = False
With ActiveSheet.PageSetup
.CenterFooter = "&P of &N pages"
.RightFooter = "&T"
.RightHeader = "&F"
.LeftHeader = "&D"
End With
Dim lngRow As Long
Dim lngCom As Long
lngRow = ActiveSheet.Range("a1").End(xlDown).row
lngCom = ActiveSheet.Range("a1").End(xlToRight).Column
With Cells(lngRow + 2, lngCom)
.FormulaR1C1 = "=countA(R2C:R[-1]C)"
.Font.ColorIndex = 3
End With
With Cells(lngRow + 2, lngCom - 1)
.Value = "total items on list :"
End With
Cells.HorizontalAlignment = xlRight
Application.ScreenUpdating = True
thanks

lucas
07-08-2006, 08:27 AM
ActiveWindow.SelectedSheets.PrintPreview

lior03
07-08-2006, 10:07 AM
dear lucas
when i added your code to mine it did not work. why?

Norie
07-08-2006, 10:25 AM
Try this.

ActiveSheet.PrintOut Preview:=True

lucas
07-08-2006, 10:35 AM
Hi moshe,
If Nories suggestion doesn't work be sure to post back...you may need to post your entire module so we can see what's going on.