A free program from Microsoft that provides developers with the tools, resources, and sandbox environments needed to build solutions for Microsoft 365.
Excel addins With Pivot code issue after upgrading office version from 2402 to any higher version
Hi Team,
Our pivot code working fine with 2402 & older version of excel, but after upgrade we facing issue with below line of codes
((Range)sheet.Range[cell44, Type.Missing].Offset[1, 0]).ShowDetail = true;
cell44 is present on sheet, we are using same dataset but its not working with new excel version.
Also I map object from temp sheet to new sheet & delete temp sheet then try to rename new sheet name its also throw exception in new version but working with old version of excels
ex: Worksheet resultSheet = null; Workbook workbook = application_.ActiveWorkbook; var sheetPivot = BookHelper.AddWorksheet(application_);
SheetHelper.SetActiveSheet(sheetPivot);
Range rngDes = sheetPivot.get_Range("A1");
PivotTable pivotTable = cache.CreatePivotTable(TableDestination: rngDes, TableName: pivotSheetName, DefaultVersion: XlPivotTableVersionList.xlPivotTableVersion10);
//END Microsoft bug fix - October 2017
ActiveSheet.PivotTableWizard(Type.Missing, Type.Missing, ActiveSheet.Cells[3, 1], Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
((Range)ActiveSheet.Cells[3, 1]).Select();
ActiveSheet.Name = tempSheetName; ..... logic resultSheet = ActiveSheet; var tempSheet = (Worksheet)workbook.Sheets[tempSheetName];
tempSheet.Delete(); resultSheet.Name = newSheetName; // throw error