Solved

Create an Excel file ??

Posted on 2001-08-22
4
366 Views
Last Modified: 2010-04-06

How can I create an Excel file using the "servers" component with Delphi 6 ?

This code do not work:

  ExcelApplication1.Connect ;
  Try
    ExcelApplication1.Workbooks.Open('C:\Test.xls',
      EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam,
      EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam,
      EmptyParam, EmptyParam, 0) ;
    ExcelWorkSheet1.ConnectTo(ExcelApplication1.Sheets[1] As _WorkSheet) ;
  Except
    ShowMessage('Oupss !') ;
  End ;

0
Comment
Question by:frdep
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
RickHalle earned 50 total points
ID: 6415788
Try this:

  ExcelApplication1.Connect;

  ExcelApplication1.Connect;
  try
    ExcelApplication1.Workbooks.Open('C:\Book1.xls',
      EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam,
      EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam,
      EmptyParam, EmptyParam, 0);
    ExcelApplication1.Visible[0] := true;
//   ExcelWorkSheet1.ConnectTo(ExcelApplication1.Sheets[1] As _WorkSheet) ;
  except
    ShowMessage('Oupss !');
  end;

What you had appears to make the connection but there is no feedback to let you know this.

Rick Halle
0
 
LVL 2

Expert Comment

by:RickHalle
ID: 6419919
Was that what you were looking for?
0
 
LVL 2

Expert Comment

by:florisb
ID: 6432080
Hi,

If you search in the PAQ, you will find some example code of me, that creates an excell file and fills it with items.

Cu,
Floris.
0
 
LVL 17

Expert Comment

by:geobul
ID: 9287993
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

accept RickHalle's comment as answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Thanks,

geobul
EE Cleanup Volunteer
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Comparing dates in Delphi. Greater than/ Less than 3 219
oracle global variables 4 76
Wincontrol not (correctly) drawn 15 42
enhance the following code 3 37
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question