MACRO LIBRARY

Export all drawing sheets to a single PDF

Free public access. No account or subscription required.

Files

Export all drawing sheets to single PDF

Code

'Export all drawing sheets in a single PDF
    
'Written by Keith Rice
'CADSharp LLC
'www.cadsharp.com
    
'Preconditions: drawing is open
'Results: PDF called "export.pdf" is exported to C:\
    
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDraw As SldWorks.DrawingDoc
Dim swExport As SldWorks.ExportPdfData
Dim vSheetNames As Variant
    
Sub main()
    Set swApp = Application.SldWorks
    Set swModel = swApp.ActiveDoc
    Set swDraw = swModel
    vSheetNames = swDraw.GetSheetNames
    Set swExport = swApp.GetExportFileData(swExportPdfData)
    swExport.SetSheets swExportData_ExportAllSheets, vSheetNames
    swModel.Extension.SaveAs "C:\export.pdf", swSaveAsCurrentVersion, swSaveAsCurrentVersion, _
        swExport, Empty, Empty
End Sub