ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
BSBrennan Sheremeto15/04/2016

Hi,

I'm writing a save as PDF macro and I have it working properly except for I don't want it to save sheets named "DXF" in the PDF file. Here is the code I have (from another post on here) to strip out the PDFs with DXF in the name.

'GET PDF DATA AND SAVE

Set swExportPdfData = swApp.GetExportFileData(swExportDataFileType_e.swExportPdfData)

  

    ReDim strSheetName(0)

    Dim s As Variant

    For Each s In swDrawDoc.GetSheetNames

        If Not UCase(s) Like "*DXF*" Then

            strSheetName(UBound(strSheetName)) = s

            ReDim Preserve strSheetName(UBound(strSheetName) + 1)

        End If

    Next s

  

    varSheetName = strSheetName

    If swExportPdfData Is Nothing Then MsgBox "Nothing"

    boolstatus = swExportPdfData.SetSheets(swExportData_ExportSpecifiedSheets, varSheetName)

  

boolstatus = swModelDocExt.SaveAs(SavePath, 0, 0, swExportPdfData, lErrors, lWarnings)

However the DXF sheet still gets saved.