Solved

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

Posted on 1997-04-01
1
131 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 94
How to use Hashing sha1 in Delphi 2010 4 201
Mydac connection data base issue 3 139
Graphics32 under Delphi 10.1 Berlin 2 36
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…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

911 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

26 Experts available now in Live!

Get 1:1 Help Now