Results 1 to 6 of 6

Thread: Excel Page Breaks

  1. #1

    Thread Starter
    Fanatic Member space_monkey's Avatar
    Join Date
    Apr 2005
    Location
    神と歩くこと
    Posts
    573

    Excel Page Breaks

    Is there a way to remove the default page breaks that excel puts in?

    I've tried xls.ResetAllPageBreaks but it doesn't seem to work.

    I've also tried

    Code:
    xls.Activate
    ActiveWindow.View = xlPageBreakPreview
    ActiveSheet.VPageBreaks(1).DragOff Direction:=xlToRight, RegionIndex:=1
    which is what a recorded macro told me to do. And i get an error (Subscript out of range)

    I appreciate any help.
    Using VB6 or VB.net 2008 with .net 3.5
    "Life... death... either way I'll be confined to a small cubicle!" - Hermes Conrad

  2. #2
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: Excel Page Breaks

    Try this:

    Using VBA to Remove All User set Page Breaks:
    VB Code:
    1. ActiveSheet.ResetAllPageBreaks

    or remove separately
    VB Code:
    1. activesheet.Rows.PageBreak = xlNone
    2.     activesheet.Columns.PageBreak = xlNone
    CS

  3. #3

    Thread Starter
    Fanatic Member space_monkey's Avatar
    Join Date
    Apr 2005
    Location
    神と歩くこと
    Posts
    573

    Re: Excel Page Breaks

    This wouldn't be a user set page break it would be an excel set page break. Would there be any way to get rid of that?

    In other words is there a way to set page breaks to manual only?
    Using VB6 or VB.net 2008 with .net 3.5
    "Life... death... either way I'll be confined to a small cubicle!" - Hermes Conrad

  4. #4
    Frenzied Member
    Join Date
    May 2004
    Location
    Carlisle, PA
    Posts
    1,045

    Re: Excel Page Breaks

    Page breaks are partly a function of the Printer Driver for the selected printer. Excel can't put more on a 'page' than what can be printed. In fact, when you first open a sheet you might notice that there are no dashed pagination lines until the first time you do a print preview.

    You can change the apparent pagination by changing font sizes, column widths, and row heights, but Excel is going to make some kind of determination as to what will fit on a page. One thing you can do is make the paper size extremely large, but then that is limited by the printer driver. Tabloid (11" x 17"), if available, is generally the largest paper size.

    What exactly are you trying to accomplish?
    Blessings in abundance,
    All the Best,
    & ENJOY!

    Art . . . . Carlisle, PA . . USA

  5. #5

    Thread Starter
    Fanatic Member space_monkey's Avatar
    Join Date
    Apr 2005
    Location
    神と歩くこと
    Posts
    573

    Re: Excel Page Breaks

    I have a report that i'm writting to excel, and one of the columns is a little large (probably the cause of the line break thats fustrating me). Anyway i'm trying write to the excel sheet in such a way that all the user has to do to get a nicely formated hard copy would be to hit the print button but.... I dunno maybe i'm being an idiot about this.
    Using VB6 or VB.net 2008 with .net 3.5
    "Life... death... either way I'll be confined to a small cubicle!" - Hermes Conrad

  6. #6
    Frenzied Member
    Join Date
    May 2004
    Location
    Carlisle, PA
    Posts
    1,045

    Re: Excel Page Breaks

    If everything fits on one sheet you can do the following, and it scales the width of the active data region to always fit within the margins of a page width.
    Code:
        With ActiveSheet.PageSetup
            .FitToPagesWide = 1
            .FitToPagesTall = False
        End With
    Blessings in abundance,
    All the Best,
    & ENJOY!

    Art . . . . Carlisle, PA . . USA

Posting Permissions

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



Click Here to Expand Forum to Full Width