
Author: Pixelot12345
How to use the Excel.Application in C++Builder. Target device is Win64.
Use the ComObj, call in CreateOleObject (“Excel.Application”).
Including ComObj is required.
In C++Builder it is below.
Import from CSV file to Excel file.
We will implement this process.
Prepare the TButton.
TButton is one in a simple form.
Next is the TButton OnClick event.
Sheet name is “Sheet 1”.
Next we will create two methods.
Read the file with TStringList.And, you write to the specified cell.
Write the imported CSV file to Excel.
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition
Where do you close the excel object crated with CreateOleObject?
The CreateOleObject doesn’t actually create an object, as such, it returns an interface to the object and this is reference-counted.
The line;
ExcelApp = Unassigned();
sets the OLE object to nil (unassigned) which correctly releases the interface.