AnsweredAssumed Answered

Sw Drawing save as PDF in specific location PDM Macro

Question asked by Javier López on Dec 5, 2019

Hi All, I am trying to save the pdf of the drawing through a Macro.

I am using the Macro below and It is working perfectly.

At the moment the pdf is saved in the same location as the drawing.

The question is, How can I save the pdf in a different location in PDM?




Sub main()  Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim swExportPDFData As SldWorks.ExportPdfData Dim strFilename As String Dim status As Boolean Dim errors As Long, warnings As Long  Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc  'Save status = swModel.Save3(swSaveAsOptions_e.swSaveAsOptions_Silent, errors, warnings)  'Export to PDF if it is a drawing If (swModel.GetType = swDocDRAWING) Then  strFilename = swModel.GetPathName strFilename = Left(strFilename, Len(strFilename) - 6) & "pdf" Set swExportPDFData = swApp.GetExportFileData(1) swModel.Extension.SaveAs strFilename, 0, 0, swExportPDFData, 0, 0  End If  End Sub