Solved

Create an Excel file ??

Posted on 2001-08-22
4
365 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

803 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