Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to copy worksheet from workbook to another workbook.

Status
Not open for further replies.

PlutoDev

Programmer
Sep 21, 2002
25
ID
I am using TExcelapplication,.. (Server pallete on delphi 7). how to using this component to copy a worksheet from workbook to another workbook.

because i want also copy pagesetup orentation (landscape or portrait).

or

any one know how to detect file excel.. using page orientation landscape or portrait. ??

worksheet.pagesetup.orientation ???


Thank's in advance
 
There is a way to find the excel commands by the macro recorder in excell, check out:

How to export data to Excel
faq102-1562

Regards

Steven van Els
SAvanEls@cq-link.sr
 
Hi.

Take a peak to this component.
I haved worked with it and with great result.

The best with this component is that it creates native excel document. No need to have Excel installed...


KungTure-RX.jpg

//Nordlund
 
I have a little unit that creates a TDataset from an excel worksheet. There i take a specific range and put it into a variant like this:

Code:
  VarArray := ExcelWorksheet1.Range[CellFrom, CellTo].Value;

So i suppose you can do this vice versa. Note that Excelworksheet1.Rows returns a Range so i think you can use it to get all the data from the sheet.

Code:
  VarArray := ExcelWorksheet1.Rows;
  Excelworksheet2.Rows := VarArray;
  // or directly
  Excelworksheet2.Rows := ExcelWorksheet1.Rows;

  //Or copy s specific range to a specific place on another sheet
  Excelworksheet2.Range['A1', 'B7'].Value := ExcelWorksheet1.Range['B2', 'C8'].Value;

Of course all these require that you are connected to those worksheets.

And please do note that i haven't been using anything else except that first line of code where i take a specific range from a worksheet to a variant.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top