Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hi all i`m created code with vba to export 10 sheets from model to pdf`s but everytimes had error with line
result = ThisDrawing.Plot.PlotToFile(plotFileName)
can you help me to solve problem?
Sub PlotMultipleSheetsByPoints()
Dim Layout As AcadLayout
Dim pt1(0 To 1) As Double
Dim pt2(0 To 1) As Double
Dim plotFileName As String
Dim i As Integer
Dim OffsetX As Double
Dim result As Boolean
Set Layout = ThisDrawing.ActiveLayout
Layout.RefreshPlotDeviceInfo
Layout.ConfigName = "DWG to PDF.pc3"
Layout.CanonicalMediaName = "ISO_full_bleed_A3_(420.00_x_297.00_MM)"
Layout.CenterPlot = True
Layout.PlotRotation = ac0degrees
Layout.StandardScale = asScaleToFit
Layout.StyleSheet = "acad.ctb"
Layout.PlotType = acWindow
' based coords
pt1(1) = 0# ' Y1
pt2(1) = 297# ' Y2
OffsetX = 420# ' weigh sheets
' plot 10 sheets
For i = 1 To 10
plotFileName = "C:\Users\user\Desktop\autoPDF\" & i & ".pdf"
' offset for every sheets
pt1(0) = (i - 1) * OffsetX ' X1
pt2(0) = pt1(0) + OffsetX + 50 ' X2
' set window to plot
Layout.SetWindowToPlot pt1, pt2
' regen and plot
ThisDrawing.Regen acAllViewports
result = ThisDrawing.Plot.PlotToFile(plotFileName)
Next i
End Sub
Solved! Go to Solution.