我无法通过VBA进行彩色打印

时间:2018-03-14 19:14:45

标签: excel vba excel-vba printing excel-2010

我录制了一张打印第2页和第3页的宏。我正在选择整个工作簿并打印第2页和第3页,因为似乎无法打印单张纸。录制宏后,我还添加了弹出窗口以选择打印机(打印机设置对话框)和输入框,以获取用户想要打印的份数。以下是代码。

Sub Print_Plan()

Application.Dialogs(xlDialogPrinterSetup).Show

Dim number As String
number = InputBox("How many copies do you want", , 1)
If number = "" Then Exit Sub

Application.PrintCommunication = False
With ActiveSheet.PageSetup
    .PrintTitleRows = ""
    .PrintTitleColumns = ""
End With
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = ""
Application.PrintCommunication = False
With ActiveSheet.PageSetup
    .LeftHeader = ""
    .CenterHeader = ""
    .RightHeader = ""
    .LeftFooter = ""
    .CenterFooter = ""
    .RightFooter = ""
    .LeftMargin = Application.InchesToPoints(0)
    .RightMargin = Application.InchesToPoints(0)
    .TopMargin = Application.InchesToPoints(0)
    .BottomMargin = Application.InchesToPoints(0)
    .HeaderMargin = Application.InchesToPoints(0)
    .FooterMargin = Application.InchesToPoints(0)
    .PrintHeadings = False
    .PrintGridlines = False
    .PrintComments = xlPrintNoComments
    .PrintQuality = 600
    .CenterHorizontally = False
    .CenterVertically = False
    .Orientation = xlLandscape
    .Draft = False
    .PaperSize = xlPaperLegal
    .FirstPageNumber = xlAutomatic
    .Order = xlDownThenOver
    .BlackAndWhite = False
    .Zoom = False
    .FitToPagesWide = 1
    .FitToPagesTall = 1
    .PrintErrors = xlPrintErrorsDisplayed
    .OddAndEvenPagesHeaderFooter = False
    .DifferentFirstPageHeaderFooter = False
    .ScaleWithDocHeaderFooter = True
    .AlignMarginsHeaderFooter = True
    .EvenPage.LeftHeader.Text = ""
    .EvenPage.CenterHeader.Text = ""
    .EvenPage.RightHeader.Text = ""
    .EvenPage.LeftFooter.Text = ""
    .EvenPage.CenterFooter.Text = ""
    .EvenPage.RightFooter.Text = ""
    .FirstPage.LeftHeader.Text = ""
    .FirstPage.CenterHeader.Text = ""
    .FirstPage.RightHeader.Text = ""
    .FirstPage.LeftFooter.Text = ""
    .FirstPage.CenterFooter.Text = ""
    .FirstPage.RightFooter.Text = ""
End With
Application.PrintCommunication = True

Sheet1.PageSetup.PrintArea = "$A$1:$BS$50"

ActiveWorkbook.PrintOut From:=2, To:=3, Copies:=number, Collate:=True, _
    IgnorePrintAreas:=False

End Sub

用户还希望以彩色打印。这里的问题是只能从打印机属性中选择颜色选项。Printer Setup and Properties

我注意到可以通过单击设置按钮从打印设置中打开打印属性。但即使我选择颜色,也不会打印出彩色。另外,我还没有找到以任何其他方式打开打印属性的方法。我甚至添加了black and white = false,但它打印出黑色和白色。

如何更改代码以便用户可以选择彩色打印?

0 个答案:

没有答案
相关问题