右击工作表标签—查看代码—插入—模块—粘贴代码—关闭VBE编辑器,回到工作表,工具—宏—宏,选择Print_双面,单击执行。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | Sub Print_双面()
Dim pageTotal As Integer
Dim jPage As Integer
Dim OK
pageTotal = Application.ExecuteExcel4Macro( "get.document(50)" )
For jPage = pageTotal - IIf(pageTotal Mod 2 = 0, 1, 0) To 1 Step -2
ActiveSheet.PrintOut from:=jPage, To :=jPage
Next
OK = MsgBox( "请把纸张装入打印机,打印偶数页" , vbOKCancel, "双面打印" )
If OK = vbOK Then
For jPage = 2 To pageTotal Step 2
ActiveSheet.PrintOut from:=jPage, To :=jPage
Next
End If
End Sub
|