Reputation: 85
Hi how can I Plot to Pdf my AutoCAD drawing using VBA? I Tried
Sub PlotToPdf()
ThisDrawing.ActiveLayout.ConfigName = "DWF6 ePlot.pc3"
Dim plotFileName As String
plotFileName = "Z:\USERS\KweziM\PROJECT S\MyPlot.pdf"
Dim result As Boolean
result = ThisDrawing.Plot.PlotToFile(plotFileName)
End Sub
But this does not work.
Upvotes: 0
Views: 4207
Reputation: 11735
That last line should be a subroutine call, not a function call... it should look like this
ThisDrawing.Plot.PlotToFile plotFileName
You do not need the result
variable.
Upvotes: 1
Reputation: 1697
try this:
Public Sub VBAplot()
Dim currentplot As AcadPlot
Set currentplot = ThisDrawing.Plot
ThisDrawing.ActiveLayout.ConfigName = "PDFCreator" ' Your plot device.
ThisDrawing.ActiveLayout.CanonicalMediaName = "A4"
ThisDrawing.ActiveLayout.StandardScale = acScaleToFit
ThisDrawing.Application.ZoomExtents
currentplot.PlotToDevice
End Sub
Upvotes: 0