'选择纸张 If OptionButton1.Value = True Then ThisDrawing.ModelSpace.Layout.CanonicalMediaName = "A4" ElseIf OptionButton2.Value = True Then ThisDrawing.ModelSpace.Layout.CanonicalMediaName = "A3" End If
' 设置打印份数为1 ThisDrawing.Plot.NumberOfCopies = 1
' 开始打印 ThisDrawing.Plot.QuietErrorMode = True
'旋转设置 If PlotUpRight(0) - PlotLowLeft(0) > PlotUpRight(1) - PlotLowLeft(1) Then ThisDrawing.ModelSpace.Layout.PlotRotation = ac90degrees Else ThisDrawing.ModelSpace.Layout.PlotRotation = ac0degrees End If
ThisDrawing.Plot.PlotToDevice DoEvents
End Sub
PlotZone是传递给子程序的打印区域,4元素数组,代表左上角和右下角的坐标。 PlotRagType是全局变量,AcPlotType类型,代表是窗口还是范围等打印方式。 ComboBox1中是打印机列表,可通过以下代码在父程序初始化时取得: plotDevices = ThisDrawing.ModelSpace.Layout.GetPlotDeviceNames() For I = LBound(plotDevices) To UBound(plotDevices) ComboBox1.AddItem plotDevices(I) Next OptionButton1和2用来选择a4还是a3纸。 你需要添加父程序,取得打印范围的左上交和右下角,然后一次次调用这个子程序,就可以批量打印了