Macro: export PDF several sheets in the same file

Hello

 I got a macro to do PDF exports, I slightly modified it to export all the configurations with the same plan. I would like to make two sheets on this plan.

only it exports the leaves independently.

Do you know a way to put both sheets in the same file?

Part of the code concerned:

While i <= iT - 1
          'Layout view20
            boolstatus = Part.Extension.SelectByID2("Drawing View20", "DRAWINGVIEW", 0.195997909234212, 0.164382166839605, 0, False, 0, Nothing, 0)
            Set swView = swSelMgr.GetSelectedObject6(1, 0)
            swView.ReferencedConfiguration = vNameConf(i)
        'Layout view17
            boolstatus = Part.Extension.SelectByID2("Drawing View17", "DRAWINGVIEW", 0.127659480183812, 0.163338832044942, 0, False, 0, Nothing, 0)
            Set swView = swSelMgr.GetSelectedObject6(1, 0)
            swView.ReferencedConfiguration = vNameConf(i)
        'Drawing view16
            boolstatus = Part.Extension.SelectByID2("Drawing View16", "DRAWINGVIEW", 6.19293881200676E-02, 0.163338832044942, 0, False, 0, Nothing, 0)
            Set swView = swSelMgr.GetSelectedObject6(1, 0)
            swView.ReferencedConfiguration = vNameConf(i)
        '
            Part.ClearSelection2 True

            Part.ForceRebuild3 True

            For a = 1 TB swModel.GetSheetCount
                swModel.ActivateSheet vSheets(a - 1)
                Set swSheet = swModel.GetCurrentSheet
                ' To save the sheet as a PDF
                Set swModelDocExt = swModel.Extension
                Set swExportPDFData = swApp.GetExportFileData(1)
                swExportPDFData.ViewPdfAfterSaving = False
                nFileName = Path & "\" & vNameConf(i) & "-" & lastInd & "-" & swSheet.GetName & ".PDF"
                boolstatus = swExportPDFData.SetSheets(swExportData_ExportSpecifiedSheets, swSheet.GetName)
                boolstatus = swModelDocExt.SaveAs(nFileName, 0, 0, swExportPDFData, lErrors, lWarnings)
            Next a
            'MsgBox i
            i = i + 1
            
           Wend


macro_pdf_enregistrer_sous-2.swp

Hello

This is what the example given here does.

Kind regards

Thank you
Difficult to understand, it's but first macro, it seems to me that this code is full of typos probably made by the translation...

But if I understand I have to make a variable with the name of all my sheets.

I test cool

All you had to do was replace a value, not an array

swSheet in the active sheet variable

swExportPDFData.SetSheets(swExportData_ExportSpecifiedSheets, swSheet.GetName)

vSheet and viable sheets

boolstatus = swExportPDFData.SetSheets(swExportData_ExportSpecifiedSheets, vSheet)