Solved

How to delete rows in Excel document using TExcelApplication object

Posted on 2003-10-27
2
483 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
2 Comments
 
LVL 11

Accepted Solution

by:
robert_marquardt earned 100 total points
Comment Utility
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
Comment Utility
Here is the correct code

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

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now