Solved

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

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert Jpg /PNG To GIF 5 150
Virtuailstring tree compare node issue 14 125
Correct Component for Shopping Cart. 2 112
tidtcpserver connection lost handle 2 103
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

838 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