请用宏代码回答:Excel工作簿下所有工作表如何批量设置奇偶页都不同的页边距来批量打印?
答案:2 悬赏:50 手机版
解决时间 2021-02-26 08:40
- 提问者网友:最美的风景
- 2021-02-25 23:38
Excel工作簿下有若干个工作表,若干个工作表想批量双面打印,打印出来装订在奇页的左边,也就是装订在偶页的右边,所以奇偶页的边距要不一样才好装订。
最佳答案
- 五星知识达人网友:鱼忧
- 2021-02-25 23:54
试试下面代码吧
Sub 打印奇偶页()
Dim TotalPg As Integer
TotalPg = ExecuteExcel4Macro("GET.DOCUMENT(50)")
MsgBox "现在开始打印奇数页"
'设置页边距(英寸)(1英寸=2.54厘米)
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(2.3622) '左边距6cm
.RightMargin = Application.InchesToPoints(0.748) '右边距1.9cm
End With
For i = 1 To TotalPg Step 2
ActiveSheet.PrintOut From:=i, To:=i
Next
MsgBox "现在开始打印偶数页"
'设置页边距
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.748) '左边距1.9cm
.RightMargin = Application.InchesToPoints(2.3622) '右边距6cm
End With
For i = 2 To TotalPg Step 2
ActiveSheet.PrintOut From:=i, To:=i
Next
End Sub
Sub 打印奇偶页()
Dim TotalPg As Integer
TotalPg = ExecuteExcel4Macro("GET.DOCUMENT(50)")
MsgBox "现在开始打印奇数页"
'设置页边距(英寸)(1英寸=2.54厘米)
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(2.3622) '左边距6cm
.RightMargin = Application.InchesToPoints(0.748) '右边距1.9cm
End With
For i = 1 To TotalPg Step 2
ActiveSheet.PrintOut From:=i, To:=i
Next
MsgBox "现在开始打印偶数页"
'设置页边距
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.748) '左边距1.9cm
.RightMargin = Application.InchesToPoints(2.3622) '右边距6cm
End With
For i = 2 To TotalPg Step 2
ActiveSheet.PrintOut From:=i, To:=i
Next
End Sub
全部回答
- 1楼网友:掌灯师
- 2021-02-26 01:12
我是来看评论的
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯