Solved

Creating Excel v5.0 Add-Ins using Delphi v1.0

Posted on 1997-04-01
1
130 Views
Last Modified: 2012-05-04
Unfortunatly all the examples in the developers kit are written only in C, and although I'm sure it can be done in Delphi, I have yet to figure out how.

What I would like is a sample project which allows me to return say the "Square" of a number from excel.

The Excel cell should be something like =OurFunction(2)

This would return a 4 into the cell.  The Delphi project should of course create a library (DLL) that will be called from Excel.  I have a much bigger project to write for Excel but I need a starting point to build on.
0
Comment
Question by:agrilk
1 Comment
 
LVL 2

Accepted Solution

by:
vorlon earned 100 total points
ID: 1335090
Agrilk,
I might have a solution for you but I'm not sure it will be satisfactory. Try this:

1) Create a DLL in Delphi containing whatever functions you need to access form Excel. In this case, a function such as:

function OurFunction(x:integer):integer;
begin
   OurFunction:=x*x;
end;

Place all functions in a seperate unit, and make the project a DLL. (Don't forget the "export" keyword next to the function definitions). If you need help with this let me know.

After you have a DLL, go into Excel, insert a module and add a function that link to the dll functions. Again, in this case:

Declare the Delphi Dll functions:
Declare Function OurFunction Lib "c:\delphi.dll" (ByVal x as integer)

Function GetSquare(x as integer)
   GetSquare=OurFunction(x)
End function

Once this is done, remove any other sheets from this workbook. Go to Tools, and select Make Add-In... This will create an add-in that you normally wanted.

The reason I mentioned that you might not find this acceptable is because you have to create the extra function calls from excel to access the dll. I don't know of a way around this. If you find a way, please let me know.

Good luck.

0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 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

22 Experts available now in Live!

Get 1:1 Help Now