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 

Adding a Excel Worksheet to a Workbook in Delphi 7

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





PostPosted: Tue Jan 04, 2005 8:34 am    Post subject: Adding a Excel Worksheet to a Workbook in Delphi 7 Reply with quote



I used the following Lines of code in Delphi5 that worked fine to open
multiple sheets in my workbook, but now I have started going over to
delphi 7 and now I get an OLE error 800A03EC when the line with the
#'s is executed at runtime.

Any body have a clue what the problem is?


where
bookBS: TExcelWorkbook;
excelBS: TExcelApplication;
sheetBSH: TExcelWorksheet;
sheetBSL: TExcelWorksheet;

begin
LCID := GetUserDefaultLCID;

excelBS.Connect;
excelBS.Visible[LCID] := true;

bookBS.ConnectTo(excelBS.Workbooks.Add(xlWBATWorksheet, LCID));
sheetBSL.ConnectTo(bookBS.Worksheets[1] as _Worksheet);
sheetBSL.Name := NewModel.Name + '-Low';

sheetBSH.ConnectTo(bookBS.Sheets.Add(1, 1, 1, xlWBATWorksheet, LCID)
as _Worksheet); ## --- error when this line executes

sheetBSH.Name := NewModel.Name + '-High';
....
end;
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.