?
Solved

OLE between D2 and Excel97

Posted on 1997-06-26
2
Medium Priority
?
256 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

650 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