Solved

Using Delphi to control Excel:How to merge cells?

Posted on 2002-05-17
6
4,415 Views
Last Modified: 2007-12-19
//thanks :)
var
  ExcelApplication1: TExcelApplication;
  ExcelWorksheet1: TExcelWorksheet;
  ExcelWorkbook1: TExcelWorkbook;
begin
  {
  I Created the three objects properly,and i can write
  data into Excel now
  }
  //if i want to merge some cells,[1,2]-[4,5],for example
  ExcelWorkSheet1.Cells.Merge({what should be here?});
  //or use ExcelWorkSheet1.Cells.MergeCells?? or what
end;
0
Comment
Question by:Conwood
6 Comments
 
LVL 11

Expert Comment

by:robert_marquardt
Comment Utility
You should install the VBA help of Excel.
See if it is on your Office CD.
VBA calls the same COM objects you call from Delphi so the VBA help should give you the info you need.
Record a macro and have a look at the macro source.
0
 
LVL 4

Expert Comment

by:max-hb
Comment Utility
Hi!
Maybe you shouldlook at
http://www.paragoncorporation.com/papers/articledetail.asp?ArticleID=2

This article gives a (very) brief introduction to Excel programming (using VBA)
0
 
LVL 22

Expert Comment

by:mnasman
Comment Utility
hello

  look at these links they will help you for automation excel

Automating Microsoft Excel using delphi
http://www.djpate.freeserve.co.uk/AutoExcl.htm

Microsoft Office 97/Visual Basic Programmer's Guide
http://www.microsoft.com/officedev/articles/Opg/004/004.htm

0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 2

Expert Comment

by:Tasomia
Comment Utility
Hi,

Try this:
ExcelApplication1.Range['A1', 'E7'].Mergecells := True;
0
 
LVL 44

Accepted Solution

by:
bruintje earned 200 total points
Comment Utility
Tasomia is right there

though i would use the worksheet object since excel application is the big container and looking at your code you work with all three objects

app > workbook > worksheet

something like

ExcelWorksheet1.Range['A1','E7'].MergeCells := True;

besides using the VBA help files you can also use the object browser in all office apps

-open the VB Editor in Excel with ALT+F11
-then bring up the object browser with F2
-now you can walk through the objects and their properties + events

:O)Bruintje
0
 
LVL 44

Expert Comment

by:bruintje
Comment Utility
Tasomia, posted a seperate question for your help here

http://www.experts-exchange.com/delphi/Q.20302187.html
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

771 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

12 Experts available now in Live!

Get 1:1 Help Now