大家看看打印程序哪儿出错了?
<P>每次运行程序(vba) 只能打一张图然后弹出错误框:</P><P> <IMG src="UploadFile/2006-5/200651919135586.bmp"></P>
<P> Option Explicit<BR> Sub tt()<BR> Dim fn As String<BR> Dim strpath As String<BR> Dim doc As AcadDocument<BR> Dim docs As AcadDocuments<BR> Dim mdl As AcadModelSpace<BR> Dim plt As AcadPlot<BR> Dim dl(1) As Double, ur(1) As Double<BR> dl(0) = 443.2937: dl(1) = 203.4134<BR> ur(0) = 708.265: ur(1) = 522.5616<BR> strpath = "E:\重要工程\控制\控制点点之记\123\"<BR> Dim filname As String, dirf() As String<BR> Dim i As Integer, j As Integer<BR> filname = Dir(strpath + "*.dwg")<BR> i = 1<BR> Do While filname <> ""<BR> ReDim Preserve dirf(1 To i) As String<BR> dirf(i) = strpath + filname<BR> filname = Dir<BR> i = i + 1<BR> Loop<BR> j = UBound(dirf)<BR> Set docs = ThisDrawing.Application.Documents<BR> For i = 1 To j<BR> Set doc = docs.Open(dirf(i))<BR> ThisDrawing.Application.ZoomExtents<BR> Set mdl = doc.ModelSpace<BR> With mdl.Layout<BR> .ConfigName = "hp LaserJet 1320 PCL 6"<BR> .StandardScale = acScaleToFit<BR> .PlotRotation = ac0degrees<BR> .SetWindowToPlot dl, ur<BR> .PlotType = acWindow<BR> .CenterPlot = True<BR> End With<BR> ' On Error Resume Next<BR> doc.Plot.PlotToDevice<BR> doc.Close False<BR> Next i<BR> MsgBox "finish", vbOKOnly, "OK"<BR> End Sub</P> 设置系统变量BACKGROUNDPLOT lgf727说得对,将Backgroundplot变量设为0即可。关于这一点,我一直没明白,为什么Autodesk做成这个样子。
页:
[1]