For For Next Next

Hello, can we do two For Next loops ?

My macro works either at one or the other but not both at the same time!

Hello

If you can copy your code, it will help to understand the problem

I made a while loop and another For to solve my problem 

= 1
            
          While i <= iT - 1
            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) & 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

But I have my initial idea was:

For i = 1 TB swModel.GetConfigurationCount
            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) & swSheet.GetName & ".PDF"
                boolstatus = swExportPDFData.SetSheets(swExportData_ExportSpecifiedSheets, swSheet.GetName)
                boolstatus = swModelDocExt.SaveAs(nFileName, 0, 0, swExportPDFData, lErrors, lWarnings)
            Next a
           Next i