Solved

Using Delphi to control Excel:How to merge cells?

Posted on 2002-05-17
6
4,863 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
[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
6 Comments
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 7016039
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
ID: 7016073
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:Mohammed Nasman
ID: 7016104
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:Tasomia
ID: 7017999
Hi,

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

Accepted Solution

by:
bruintje earned 200 total points
ID: 7018737
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
ID: 7019360
Tasomia, posted a seperate question for your help here

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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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 this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

729 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