本帖最后由 作者 于 2009-6-4 15:55:29 编辑
以下程序,(2004下可以打印,本人已经验证)2008下只能打一张图纸,F8跟踪时候,第二循环次运行到 ThisDrawing.plot.PlotToDevice时出错,提示PlotToDevice作用错误  ublic Sub pp() Dim objsel As AcadEntity Dim ptLowLeft As Variant Dim ptUpRight As Variant For Each objsel In ThisDrawing.PaperSpace If objsel.ObjectName = "AcDbBlockReference" Then '筛选出Block If objsel.Name Like "图框A*" Then '只选图框块 !!!区分大小写 objsel.GetBoundingBox ptLowLeft, ptUpRight ReDim Preserve ptLowLeft(1) ReDim Preserve ptUpRight(1) ThisDrawing.PaperSpace.Layout.SetWindowToPlot ptLowLeft, ptUpRight ThisDrawing.PaperSpace.Layout.PlotType = acWindow PrinterConfigPath = "\\wys\EPSON EPL-2180 Advanced" ThisDrawing.PaperSpace.Layout.PaperUnits = acMillimeters ThisDrawing.PaperSpace.Layout.UseStandardScale = True ThisDrawing.PaperSpace.Layout.StandardScale = acScaleToFit ThisDrawing.PaperSpace.Layout.StyleSheet = "au.ctb" ThisDrawing.PaperSpace.Layout.CanonicalMediaName = "A3" ThisDrawing.PaperSpace.Layout.PaperUnits = acMillimeters ThisDrawing.plot.NumberOfCopies = 1 ThisDrawing.plot.QuietErrorMode = True ThisDrawing.plot.PlotToDevice End If End if Next End Sub |