【发布时间】:2021-10-23 16:06:05
【问题描述】:
我正在尝试插入分页符,以便每 8 行打印 8 行 Excel 工作表。我遇到的问题是,当使用“ActiveWindow.View = xlPageBreakPreview”方法时,第一个分页符发生在第 10 行之后,然后从那里开始,每 8 行发生一次。这是我目前使用的代码:
ActiveSheet.ResetAllPageBreaks
ActiveWindow.View = xlPageBreakPreview
ActiveSheet.VPageBreaks(2).DragOff Direction:=xlToRight, RegionIndex:=1
ActiveSheet.VPageBreaks(1).DragOff Direction:=xlToRight, RegionIndex:=1
With ActiveSheet.PageSetup
.CenterHeader = "&""Chiller""&75WOC"
.CenterFooter = "&""Chiller""&75 PLACARD"
.PrintQuality = 600
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlLandscape
.PaperSize = xlPaperLetter
.Zoom = 45
.LeftMargin = Application.InchesToPoints(0)
.RightMargin = Application.InchesToPoints(0)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(0.75)
.HeaderMargin = Application.InchesToPoints(0.3)
.FooterMargin = Application.InchesToPoints(0.3)
End With
我尝试添加此循环以手动添加分页符,但它使代码陷入困境,所以我想知道是否有一个我不知道的更简单的解决方案。
非常感谢任何帮助。
【问题讨论】: