0

我在 Excel 中有一个打印输出按钮,该按钮分配给以下代码:

Private Sub CommandButton1_Click()
    Application.ScreenUpdating = False
    Sheets(Array("Cover", "1", "1-1", "2", "3", "4")).PrintOut , , 1
    Sheet1.PrintOut , , 1 'use this method to print all together at the end instead printing individually.
    Application.ScreenUpdating = True
End Sub

但是,它开始打印 100 个随机页面,每页有 3-10 个值,而不是打印工作表(这实际上没有意义)。在所有工作表上设置和检查打印范围,我真的不明白错误来自哪里。

有任何想法吗?

预先感谢!

4

1 回答 1

0

您仍然可以通过这种方式使用 PrintOut:

Private Sub CommandButton1_Click()
    Application.ScreenUpdating = False

    'If you want only to print the active sheet
    Sheet1.PrintOut

    'Printing a range, from the first page until page 23, one copy:
    Sheet1.PrintOut 1,23,1

    'Printing only a single page (23), two copies:
    Sheet1.PrintOut 23,23,2

    Application.ScreenUpdating = True
End Sub

看一个: https ://msdn.microsoft.com/en-us/library/office/ff838253.aspx

于 2015-10-30T11:51:07.967 回答