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

x
?
Solved

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

Posted on 1997-04-01
1
Medium Priority
?
139 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
[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
1 Comment
 
LVL 2

Accepted Solution

by:
vorlon earned 300 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
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