BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Ole Error Excel

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation
View previous topic :: View next topic  
Author Message
Rei
Guest





PostPosted: Mon Sep 25, 2006 3:31 pm    Post subject: Ole Error Excel Reply with quote



Hi,
I got an error OLE -2146959355: Server Execution Failed while trying to
export and view my report to Excel after several times.
Here's my code:

uses ComObj;
var Excel: Variant;
Workbook: Variant;
begin
try
Excel:= CreateOleObject('Excel.Application');
//Export to 'C:\export.xls';
Excel.Workbooks.open('C:\export.xls');
Workbook := Excel.ActiveWorkBook;
Excel.Visible:= True;
finally
WorkBook := Unassigned;
Excel := Unassigned;
end;
end;

This error only happens in Win98, and it got raised in line CreateOleObject;
It seems that Excel still hang around in memory, running invisibly, and
causing low of virtual memory in my computer.
What am I doing wrong?

TIA
Back to top
Mike Shkolnik
Guest





PostPosted: Tue Sep 26, 2006 1:44 am    Post subject: Re: Ole Error Excel Reply with quote



Add the next lines in finally section:

Workbook.Close;
Excel.Quit;

--
With best regards, Mike Shkolnik
E-mail: mshkolnik (AT) scalabium (DOT) com
WEB: http://www.scalabium.com

"Rei" <niwra2000 (AT) yahoo (DOT) com> wrote in message
news:4517b00d (AT) newsgroups (DOT) borland.com...
Quote:
Hi,
I got an error OLE -2146959355: Server Execution Failed while trying to
export and view my report to Excel after several times.
Here's my code:

uses ComObj;
var Excel: Variant;
Workbook: Variant;
begin
try
Excel:= CreateOleObject('Excel.Application');
//Export to 'C:\export.xls';
Excel.Workbooks.open('C:\export.xls');
Workbook := Excel.ActiveWorkBook;
Excel.Visible:= True;
finally
WorkBook := Unassigned;
Excel := Unassigned;
end;
end;

This error only happens in Win98, and it got raised in line
CreateOleObject;
It seems that Excel still hang around in memory, running invisibly, and
causing low of virtual memory in my computer.
What am I doing wrong?

TIA

Back to top
Oliver Townshend
Guest





PostPosted: Tue Sep 26, 2006 2:05 am    Post subject: Re: Ole Error Excel Reply with quote



Quote:
Workbook.Close;
Excel.Quit;

But he's making the Workbook visible, so I think he's passing it to the user
to play with.

Oliver Townshend
Back to top
Rei
Guest





PostPosted: Tue Sep 26, 2006 6:22 am    Post subject: Re: Ole Error Excel Reply with quote

Thx for the reply.
Yes, I left it open, so it's up to user when to close it.
But after consecutive export/open and manual close, this error still got
raised.

"Oliver Townshend" <oliveratzipdotcomdotau> wrote in message
news:451844a1 (AT) newsgroups (DOT) borland.com...
Quote:
Workbook.Close;
Excel.Quit;

But he's making the Workbook visible, so I think he's passing it to the
user
to play with.

Oliver Townshend

Back to top
Rei
Guest





PostPosted: Mon Oct 02, 2006 6:14 am    Post subject: Re: Ole Error Excel Reply with quote

This error quickly got raised if I had my harddisk low in space and bigger
data to export.
Is there a way to clean up all the memory used to call OLE app?



"Rei" <niwra2000 (AT) yahoo (DOT) com> wrote in message
news:451880e2 (AT) newsgroups (DOT) borland.com...
Quote:
Thx for the reply.
Yes, I left it open, so it's up to user when to close it.
But after consecutive export/open and manual close, this error still got
raised.

"Oliver Townshend" <oliveratzipdotcomdotau> wrote in message
news:451844a1 (AT) newsgroups (DOT) borland.com...
Workbook.Close;
Excel.Quit;

But he's making the Workbook visible, so I think he's passing it to the
user
to play with.

Oliver Townshend



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OLE Automation All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.