Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using Delphi to control Excel:How to merge cells?

Posted on 2002-05-17
6
Medium Priority
?
5,166 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
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.

 
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 600 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

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!

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

604 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