|
你原来的代码加个循环:
- Sub 奇偶页打印() '实现奇偶页打印
- Dim pageTotal As Integer
- Dim jPage As Integer
- Dim f As Integer, k, OK
- f = InputBox("请输入要打印的份数,默认为1份", "多份打印", "1")
- If f = "" Then Exit Sub
- Worksheets("量化表").Activate
- With Sheets("量化表")
- For k = 1 To f
- pageTotal = Application.ExecuteExcel4Macro("get.document(50)") - 2 '减2代表模板页不要打印
- For jPage = pageTotal - IIf(pageTotal Mod 2 = 0, 1, 0) To 1 Step -2
- ActiveSheet.PrintOut from:=jPage, To:=jPage
- Next
- Next '一次打印完N份的奇数页,'再打印N份的偶数页
- OK = MsgBox("请把纸张装入打印机,打印偶数页", vbOKCancel, "双面打印")
- For k = 1 To f
- If OK = vbOK Then
- For jPage = 2 To pageTotal Step 2
- ActiveSheet.PrintOut from:=jPage, To:=jPage
- Next
- End If
- Next
- End With
- End Sub
复制代码
请测试 |
|