the rule:
'define oDoc
oDoc = ThisDoc.Document
'specify the drawing sheet
oSheet = oDoc.Sheets("Sheet:1") ' sheet by name
'oSheet = oDoc.Sheets(1) ' first sheet
' say there is a Partslist on the sheet.
oPartslist = oSheet.PartsLists(1)
' create a new NameValueMap object
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
'specify an existing template file
'to use For formatting colors, fonts, etc
oOptions.Value("Template") = "I:\INVENTOR\INVENTOR_2016\CARTOUCHE\LISTE_DE_COUPE_2016.xls"
'specify the columns to export
oOptions.Value("ExportedColumns") = "COMPOSANTE;STOCK NUMBER;PI2;LONGUEUR;LARGEUR;QTY;QTE TOTALE;ÉPAISSEUR;CHANTS;DETAIL;COMMANDE;L;M;VEINAGE;USINAGE;NESTING;POIDS"
'specify the start cell
oOptions.Value("StartingCell") = "T2"
'specify the XLS tab name
'here the file name is used
oOptions.Value("TableName") = ThisDoc.FileName(False) 'without extension
'choose to autofit the column width in the xls file
oOptions.Value("AutoFitColumnWidth") = False
'choose to apply cell formatting in the xls file
oOptions.Value("ApplyCellFormatting") = True
DOSSIER = ThisDoc.Path
POSITION1 = InStrRev(DOSSIER, "\")
POSITION2 = Right(DOSSIER, Len(DOSSIER) - POSITION1)
myFile2 = "I:\DOCUMENTS\ARTICLES\" & POSITION2 & "\" & POSITION2 & "_STANDARD" & ".xls"
If(System.IO.File.Exists(myFile2)) Then
Kill (myFile2)
End If
' export the Partslist to Excel with options
oPartslist.Export("I:\DOCUMENTS\ARTICLES\" & POSITION2 & "\" & POSITION2 & "_STANDARD" & ".xls", _
PartsListFileFormatEnum.kMicrosoftExcel, oOptions)
'define Excel Application object
excelApp = CreateObject("Excel.Application")
'set Excel to run visibly
'change to false if you want to run it invisibly
excelApp.Visible = True
'open the workbook
wb = excelApp.Workbooks.Open("I:\DOCUMENTS\ARTICLES\" & POSITION2 & "\" & POSITION2 & "_STANDARD" & ".xls")
'suppress prompts (such as the compatibility checker)
excelApp.DisplayAlerts = False
'select the original exported sheet
excelApp.Sheets(ThisDoc.FileName(False)).Select
'cut a column
excelApp.Columns("S:AM").Cut
'select sheet to paste to
excelApp.Sheets("EXPORTATION").Select
'select range to paste to
excelApp.Range("A1").Insert
excelApp.Range("T2")=iProperties.Value("Summary", "Author")
excelApp.Sheets(ThisDoc.FileName(False)).Select
excelApp.Range("A3").Select
'save the workbook
wb.Save