Excel addins With Pivot code issue after upgrading office version from 2402 to any higher version

Dattaram Rajput, Bhushan 0 Reputation points
2025-02-25T07:32:48.8766667+00:00

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

Microsoft 365 Developer Program
Microsoft 365 Developer Program
Microsoft 365: Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line.Developer Program: A Microsoft program designed to help developers build cross-platform productivity experiences by giving them access to a developer subscription, sample data packs, documentation, training, experts, recommendations, and community events.
30 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.