|
我个人觉得,保留几个主要的参数就够了。
我有一个页面设计的一段代码。
看是否合意。
Public Sub 自定义页面(Paper As String, Bsh As String, TxtColm As Integer, Optional Wdh As Single, Optional Hgt As Single)
On Error Resume Next
Select Case Paper
Case "A4"
wd = IIf(Bsh = "hb", 297, 210)
ht = IIf(Bsh = "hb", 210, 297)
lk = IIf(Bsh = "hb", 265, 178)
Case "16K"
wd = IIf(Bsh = "hb", 260, 184)
ht = IIf(Bsh = "hb", 184, 260)
lk = IIf(Bsh = "hb", 228, 152)
Case "zdy"
wd = IIf(Bsh = "hb", Hgt, Wdh)
ht = IIf(Bsh = "hb", Wdh, Hgt)
lk = IIf(Bsh = "hb", Hgt - 32, Wdh - 32)
End Select
With ActiveDocument.PageSetup
.Orientation = IIf(Bsh = "hb", wdOrientLandscape, wdOrientPortrait) '2 页面方向为纵向;wdOrientLandscape--横向
.PageWidth = MillimetersToPoints(wd) '纸张宽宽度厘米(mm)
.PageHeight = MillimetersToPoints(ht) '纸张高宽度厘米(mm)
.TopMargin = MillimetersToPoints(12) '上边距厘米(mm)
.BottomMargin = MillimetersToPoints(12) '下边距厘米(mm)
.LeftMargin = MillimetersToPoints(16) '左边距厘米(mm)
.RightMargin = MillimetersToPoints(16) '右边距厘米(mm)
.HeaderDistance = MillimetersToPoints(12.5) '页眉
.FooterDistance = MillimetersToPoints(12.5) '页脚
.Gutter = MillimetersToPoints(0) '装订线
.LayoutMode = wdLayoutModeDefault '版式模式为无网络,作用:紧缩行距
With .TextColumns '分栏设置
.SetCount NumColumns:=TxtColm '栏数
.EvenlySpaced = True '栏间距
.LineBetween = False '分栏线
If TxtColm <> 1 Then .Width = MillimetersToPoints(lk)
End With
End With
End Sub |
|