Board index » delphi » Automating Excel from D3 to D5

Automating Excel from D3 to D5

Greatings to all,
In Delphi 3 I wrote a program to read data from an Excel spreadsheet. I used
the Import Type Library menu item to create a file Excel_TLB.
In the program I use:
ExcelApp := CoApplication.Create;
After that I can use ExcelApp.Workbooks.Open(...) to open an existing file.
(ExcelApp is of type _Application)

When I move this program to Delphi 5, and compile I get no error messages.
But when I run the program an 'CoInitialize has not been called' error
message apears.
I have removed the Server component palette completely, and used Import Type
Library to create a new Excel_TLB file from D5.
After some changes in the code:
ExcelApp := TExcelApplication.Create;
ExcelApp.Cells[...] changed to ExcelApp.Cells.Item[...]

I still get the same error message when I run the program.

What can I do to convert my program to D5 or is the only solution to
re-write the program to use the Excel components from the server palette?

Many thanks in advance.
Jan de Jonge


Re:Automating Excel from D3 to D5

<<Jan de Jonge:
CoInitialize has not been called


Put the line
in your project (.dpr) file. New D5 projects have this

Deborah Pate (TeamB)

  Use Borland servers; TeamB don't see posts via ISPs

Re:Automating Excel from D3 to D5

Thanks very much for your feedback.
(Sorry for my somewhat late reaction)


Other Threads