
| Subject: | Operate MSExcel using Application writen in Delphi .NET |
| Posted by: | julio baeza |
| Date: | Tue, 8 Dec 2009 |
Hello
I'm writing an application for colecting data. Once collected
it will be saved as text file. I already figured out the collection issue,
now what I'm writing is a procedure to start excel and open the
textfile. The procedure goes like this:
try
ApXls := CreateOleObject('Excel.Application')
try
ApXls.Visible := False;
Libro := ApXls.WorkBooks.Add;
Libro.Open('C:\somepath\somefile.txt');
ShowMessage(IntToStr(ApXls.WorkBooks.Worksheets.Count));
finally
ApXls.Quit;
ApXls.Free;
end;
except
end;
It used to work for plain Delphi using the ComObj library.
The problem is that in .NET this code marks the 'CreateOleObject'
as an undeclared function. I've already added ComObj to
the USES list, but the function remains undeclared.
what I should do to for using the refered function?
I'm working with CodeGear RAD studio 2007, Delphi for .NET