?
Solved

OLE between D2 and Excel97

Posted on 1997-06-26
2
Medium Priority
?
254 Views
Last Modified: 2010-04-04
What is the general syntax required to extract information from OLE with Excel97 and Delphi 2?
0
Comment
Question by:bopper
[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 1

Accepted Solution

by:
CFantin earned 400 total points
ID: 1337829
Assuming you have a bit of knowlegde about OLE,

To extract data from cells you need to connect to excel, get the active book or any open book, get the current sheet and then you can access the individual cell data.

//Open Excel Application
ExcelApp := CreateOleObject('Excel.Application');
ExcelApp.Visible := True;

//Open a workbook
XLNewBook := ExcelApp.WorkBooks.Open('C:\My Documents\WlsTemplate.xls');
//Get Active Workbook
XLNewBook := ExcelApp.ActiveWorkbook;

//Selecting a specific worksheet in the current workbook
XLActiveSheet := XLNewBook.WorkSheets[1];
//Selecting the active workbook
XLActiveSheet := XLNewBook.ActiveWorkSheet;

//Set the cell value in the current cell
XLActiveSheet.Cells[CurrentRow, CurrentColumn].Value := 'Hello workld';
//Get current cell value
MyString := XLActiveSheet.Cells[CurrentRow, CurrentColumn].Value

You can access any object in excel using this type of method.
eg Toolbars, Menus etc.

If you have the excel help installed you can get help on the objects avalible to you.
0
 

Author Comment

by:bopper
ID: 1337830
I was so close but ever so far away from the answer, thanks
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

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…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses
Course of the Month14 days, 8 hours left to enroll

770 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