G
GoFigure
Excel version: 11 (2003 SP2)
OS: WXP SP2
In a procedure to print user-specified pages, I have a section of the
code that forces manual page breaks but the pages breaks are not taking
effect. The procedure itself is long - some 300 lines. In summary,
before the code that supposed to set the pages, the procedure:
- Asks the financial quarter the user wants to print
- Then asks how many pages the user wants to print
- Sets the PrintArea accordingly
Then follows this code:
Code:
--------------------
' Remove all manual page breaks
ActiveSheet.ResetAllPageBreaks
' We set-up important PageSetup parameters set at beginning,
' so just set PrintArea
With ActiveSheet.PageSetup
.PrintArea = PA_PrintRange
End With
With ActiveSheet.HPageBreaks
' Force specific horizontal page breaks
.Add Before:=ActiveSheet.Range("B53") ' Page 1
.Add Before:=ActiveSheet.Range("B96") ' Page 2
.Add Before:=ActiveSheet.Range("B139") ' Page 3
End With
--------------------
When I put the ActiveSheet into PageView mode and step through the
".Add Before" statements, nothing at all happens.
Since I'm dealing with protected sheets, prior to the above code the
procedure unprotects the worksheet.
What have I done incorrectly?
Thanks,
- Al
OS: WXP SP2
In a procedure to print user-specified pages, I have a section of the
code that forces manual page breaks but the pages breaks are not taking
effect. The procedure itself is long - some 300 lines. In summary,
before the code that supposed to set the pages, the procedure:
- Asks the financial quarter the user wants to print
- Then asks how many pages the user wants to print
- Sets the PrintArea accordingly
Then follows this code:
Code:
--------------------
' Remove all manual page breaks
ActiveSheet.ResetAllPageBreaks
' We set-up important PageSetup parameters set at beginning,
' so just set PrintArea
With ActiveSheet.PageSetup
.PrintArea = PA_PrintRange
End With
With ActiveSheet.HPageBreaks
' Force specific horizontal page breaks
.Add Before:=ActiveSheet.Range("B53") ' Page 1
.Add Before:=ActiveSheet.Range("B96") ' Page 2
.Add Before:=ActiveSheet.Range("B139") ' Page 3
End With
--------------------
When I put the ActiveSheet into PageView mode and step through the
".Add Before" statements, nothing at all happens.
Since I'm dealing with protected sheets, prior to the above code the
procedure unprotects the worksheet.
What have I done incorrectly?
Thanks,
- Al