明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1793|回复: 2

大家看看打印程序哪儿出错了?

[复制链接]
发表于 2006-5-19 19:10:00 | 显示全部楼层 |阅读模式

每次运行程序(vba) 只能打一张图然后弹出错误框:

 

 Option Explicit
    Sub tt()
    Dim fn As String
    Dim strpath As String
    Dim doc As AcadDocument
    Dim docs As AcadDocuments
    Dim mdl As AcadModelSpace
    Dim plt As AcadPlot
    Dim dl(1) As Double, ur(1) As Double
    dl(0) = 443.2937: dl(1) = 203.4134
    ur(0) = 708.265: ur(1) = 522.5616
    strpath = "E:\重要工程\控制\控制点点之记\123\"
    Dim filname As String, dirf() As String
    Dim i As Integer, j As Integer
    filname = Dir(strpath + "*.dwg")
    i = 1
    Do While filname <> ""
       ReDim Preserve dirf(1 To i) As String
       dirf(i) = strpath + filname
       filname = Dir
       i = i + 1
    Loop
    j = UBound(dirf)
    Set docs = ThisDrawing.Application.Documents
    For i = 1 To j
       Set doc = docs.Open(dirf(i))
       ThisDrawing.Application.ZoomExtents
       Set mdl = doc.ModelSpace
       With mdl.Layout
            .ConfigName = "hp LaserJet 1320 PCL 6"
            .StandardScale = acScaleToFit
            .PlotRotation = ac0degrees
            .SetWindowToPlot dl, ur
            .PlotType = acWindow
            .CenterPlot = True
       End With
      ' On Error Resume Next
      doc.Plot.PlotToDevice
      doc.Close False
    Next i
    MsgBox "finish", vbOKOnly, "OK"
 End Sub

发表于 2006-5-19 20:26:00 | 显示全部楼层
设置系统变量BACKGROUNDPLOT
发表于 2006-5-19 22:17:00 | 显示全部楼层
lgf727说得对,将Backgroundplot变量设为0即可。关于这一点,我一直没明白,为什么Autodesk做成这个样子。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-27 04:12 , Processed in 0.133570 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表