Consulting

Results 1 to 5 of 5

Thread: print preview

  1. #1
    VBAX Mentor
    Joined
    Jun 2005
    Posts
    374
    Location

    print preview

    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.
    [VBA]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[/VBA]
    thanks
    moshe

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    [VBA]
    ActiveWindow.SelectedSheets.PrintPreview
    [/VBA]
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Mentor
    Joined
    Jun 2005
    Posts
    374
    Location
    dear lucas
    when i added your code to mine it did not work. why?
    moshe

  4. #4
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    Try this.
    [vba]
    ActiveSheet.PrintOut Preview:=True
    [/vba]

  5. #5
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    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.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •