Board index » delphi » Opening Excel from Delphi doesn't work

Opening Excel from Delphi doesn't work

<<B. Verhallen:
When i'm running my code, I see Excel appearing in my
process list for a very short while, but then it's gone
again.

Quote

If you are using a local variable for Excel, it may
disappear when your variable goes out of scope. You can set
Excel.UserControl to True to avoid that.

--
Deborah Pate (TeamB) http://delphi-jedi.org

  TeamB don't see posts sent via Google or ISPs
  Use the real Borland server: newsgroups.borland.com
  http://www.borland.com/newsgroups/genl_faqs.html

 

Re:Opening Excel from Delphi doesn't work


Hi,

I am trying to start Excel from Delphi.
According to many examples I found, this should be very easy.
I imported Excel as type library.
When i'm running my code, I see Excel appearing in my process list
for a very short while, but then it's gone again.
Can anyone tell me what the problem is here? Thanks in advance!

my code looks like this:
--
var
  ExcelApp: _Application;
begin
  try
    ExcelApp := Excel_TLB.CoApplication_.Create;
  except
    MessageDlg('Cannot start Excel!', mtError, [mbOK], 0);
  end;
  ExcelApp.Visible[LOCALE_USER_DEFAULT] := True;
--

Other Threads