?
Solved

How to delete rows in Excel document using TExcelApplication object

Posted on 2003-10-27
2
Medium Priority
?
514 Views
Last Modified: 2010-04-05
LocalFileName := 'C:\temp\ExcelDummy.xls';
ExcelApp := TExcelApplication.Create(self);
try
    ExcelApp.Connect;
    ExcelApp.WorkBooks.Open(LocalFileName,
                           EmptyParam,
                           EmptyParam,
                           EmptyParam,
                           EmptyParam,
                           EmptyParam,
                           EmptyParam,
                           EmptyParam,
                           EmptyParam,
                           EmptyParam,
                           EmptyParam,
                           EmptyParam,
                           EmptyParam,0);
    WorkBk := ExcelApp.WorkBooks.Item[1];
    WorkSheet := WorkBk.WorkSheets.Get_Item(1) as _WorkSheet;
    //I need to delete rows 3, 6, 8 in this worksheet. How do I do that??
   
end;
0
Comment
Question by:kiranmahale
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Accepted Solution

by:
robert_marquardt earned 300 total points
ID: 9631586
The easiest way is to record a macro in Excel and have a look at the macro source.
That should give you enough hints.
0
 
LVL 1

Author Comment

by:kiranmahale
ID: 9657388
Here is the correct code

WorkSheet.Range['A3', 'A3'].EntireRow.Delete(xlUp);
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

777 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