vba打印DWG图纸出现问题
Private Sub cb_print_Click()
Dim Lyouts As AcadLayouts
Dim AddedLayouts() As String
For Each tlayer In ThisDrawing.Layers
If tlayer.color = 1 Or tlayer.color = 4 Then
tlayer.Lineweight = acLnWt009
Else
tlayer.Lineweight = acLnWt005
End If
Next
If Pnum <> 0 Then
For Each Layout In ThisDrawing.Layouts
If Layout.name = "布局1" Then
ArraySize = ArraySize + 1
ReDim AddedLayouts(1 To ArraySize)
AddedLayouts(ArraySize) = Layout.name
'AddedLayouts(ArraySize) = "模型"
End If
Next
LayoutList = AddedLayouts
' Get the plot object from the drawing
Set objPlot = ThisDrawing.Plot
' Set plot options
objPlot.QuietErrorMode = True
objPlot.NumberOfCopies = Pnum
' Start the batch plot the selected layouts
objPlot.StartBatchMode ArraySize ' Number of items in this batch
Dim tem
again:
If tem < 3 Then
objPlot.SetLayoutsToPlot LayoutList
ToFP = objPlot.PlotToDevice
If ToFP = True Then
objPlot.BatchPlotProgress = True
Else
tem = tem + 1
GoTo again
End If
Else
MsgBox "请检查打印机是否准备好!", vbCritical + vbOKOnly
Exit Sub
End If
' MsgBox "打印完毕!"
Else
MsgBox "请输入要打印的份数,否则不能打印!", vbOKOnly + vbExclamation + vbApplicationModal, "警告"
tb_page.SetFocus
Exit Sub
End If
End Sub
调试时候说方法PlotToDevice作用于对象IAcadPlot怎么回事,是不是少了什么引用啊