I've written a batch plot macro and I'm having a error.
Here's the source.
=======begin code
Option Explicit
Dim strFilename As String
Dim oCurDoc As DrawingDocument
Dim oDrgPrintMgr As DrawingPrintManager
Private Sub cmdOpen_Click()
With CommonDialog1
.InitDir = ThisApplication.FileLocations.Workspace
.DialogTitle = "Display Properties"
.filter = "Inventor Files (*.iam, *.ipt, *.idw, *.ipn) | *.idw"
.FilterIndex = 2
.Flags = cdlOFNAllowMultiselect
.CancelError = True
On Error Resume Next
.ShowOpen
If Err Then
Exit Sub
End If
On Error GoTo 0
End With
' Write the selected filename to the text box.
strFilename = CommonDialog1.Filename
' Check to make sure a name was specified and call the function
' to list the properties of the file.
If strFilename <> "" Then
ShowFilelist
End If
End Sub
Private Sub ShowFilelist()
Dim i As Integer
i = InStrRev(strFilename, "\")
lstFile.AddItem (strFilename)
End Sub
Private Sub cmdPrint_Click()
Dim i As Integer
For i = 0 To lstFile.ListCount - 1
lstFile.ListIndex = i
strFilename = lstFile.Value
PrintDrawing
Next
End Sub
Private Sub PrintDrawing()
Set oCurDoc = ThisApplication.Documents.Open(strFilename, True)
oCurDoc.Activate
' imgDoc.Picture = oCurDoc.Thumbnail
If oCurDoc.DocumentType = kDrawingDocumentObject Then
Set oDrgPrintMgr = oCurDoc.PrintManager
oDrgPrintMgr.ScaleMode = kPrintBestFitScale
oDrgPrintMgr.PaperSize = kPaperSizeA4
oDrgPrintMgr.PrintRange = kPrintAllSheets
oDrgPrintMgr.Orientation = kLandscapeOrientation
oDrgPrintMgr.SubmitPrint
End If
End Sub