Fix Delphi 7 Excel 2019 Automation and #NAME? Errors
Question details
Determine why a Delphi 7 application retrieves incomplete report data in Excel 2019 unless Excel is opened first.
- Product
- Microsoft Excel 2019 and Delphi 7
- Device & OS
- not provided
- Scenario
- A Delphi 7 application automates Excel to retrieve and print a report that worked with Excel 2007 and 2010.
- Observed behavior
- Some report data is missing and affected cells show #NAME?. The report works correctly when Excel 2019 is opened before the Delphi application.
Identify the Delphi component or code used to start Excel, and note the formulas in cells that show #NAME?. Compare the Excel add-ins and workbooks loaded when Excel is started manually with those available when the application starts it.
Check how Delphi starts and connects to Excel 2019
Use this approach when the report works only after Excel has been opened manually.
In Delphi 7, open the report project and find the component or calls that obtain the Excel.Application COM object. Check whether the code relies on an existing Excel instance or can also create one.
Check whether the application uses GetActiveOleObject to attach to a running instance and CreateOleObject to start one when needed. Ensure subsequent workbook and worksheet operations use the intended instance.
Review the Office automation component and any database providers or other in-process components used by the report. Update or replace incompatible components and test the required bitness; 32-bit Delphi can generally automate 64-bit Excel through out-of-process COM, but in-process components must match the host process.
Start Excel 2019 normally, then close it and test the report again. If Excel cannot be created through COM, use Windows Settings > Apps to find Microsoft Office and select Modify > Quick Repair, then retest.
Find missing formulas, names, or add-ins behind #NAME?
Use this check if Excel opens but report cells still show #NAME?.
Review Excel-Compatible Reports with WPS Spreadsheets
WPS Office is a free, lightweight Office alternative with a familiar interface for opening and editing spreadsheets. Its Excel format support can make migration easier, although it does not repair Microsoft Excel automation or guarantee compatibility with a Delphi integration.

Frequently Asked Questions
Does Delphi 7 require the same bitness as Excel 2019?
Not necessarily. A 32-bit Delphi application can generally automate 64-bit Excel through out-of-process COM. However, in-process components such as database providers or DLLs must match the bitness of the process that loads them.
Why does the report work when I open Excel first?
The application may depend on a running Excel instance, or the manually opened instance may load an add-in or startup workbook that supplies required functions. Compare the automation code and loaded add-ins in both scenarios.
What does #NAME? mean in an Excel report?
Excel does not recognize something in the formula, such as a misspelled function, missing defined name, or unavailable custom function. Select the affected cell and inspect the formula bar, then check Formulas > Name Manager and File > Options > Add-ins.
Should I lower Excel security settings to fix the report?
Not without identifying a blocked dependency. If a trusted macro or add-in supplies a required function, check its status and trust requirements first; #NAME? alone does not prove that security is responsible.




