When you use DISPID binding that is based on an earlier version of the Excel type library to automate Excel 2002, you may receive the following error message when the program calls the ApplyDataLabels method of a Chart Series object:
The DISPID for the ApplyDataLabels method of the Series object is changed in Excel 2002 so as not to conflict with a method by the same name on the Chart object. This change does not affect late bound clients, but does affect clients that are using cached DISPIDs (such as MFC wrapper classes). Because this change can break backward compatibility with already existing clients, Microsoft has issued a fix to resolve the issue.
Microsoft Foundation Classes (MFC) Automation projects that use Class Wizard-generated wrapper classes are commonly the projects that are at risk, because Class Wizard uses DISPID binding exclusively.
Steps to Reproduce Behavior
To reproduce the issue, you need to build an MFC project on a computer that has an earlier version of Excel (such as Excel 97 or Excel 2000). The problem is specific to clients that are made for those earlier versions and then used with Excel 2002.
On a computer with Excel 97 or Excel 2000, use the MFC AppWizard to build a simple Dialog project. To make the basic program, use the steps that are detailed in the following Microsoft Knowledge Base article:
Open Excel 97 or Excel 2000 and add the following data to cells A1:D4 of Sheet1:
June July August
Sally 34.56 56.76 23.54
Fred 45.76 47.23 39.65
John 42.23 38.43 51.87
Select the cells with the data, then click Chart on the Insert menu to start the chart wizard. Accept the defaults and click Finish to make a chart. Note that the chart should appear on the same sheet as the data.
Save the workbook as C:\Chart.xls. If you name the workbook something else, or change its location, you need to modify the code in OnRun to point to the correct file name and path.
Close Excel and switch back to the MFC project.
Build the project and run the program. Note that the program runs correctly on a computer that is automating Excel 97 or Excel 2000.
Move the MFC program to a computer that has Excel 2002. Copy the Chart.xls file to the same relative path on the new computer.
Run the MFC program on the computer that is automating Excel 2002. Note that you receive the "Member not found" error message when the ApplyDataLabels method for the Series object is called.