Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Could some one provide a step-by-step instruction on:
(1) Create a public function, such as Public Function Addition(double A, double B) As Double Addition=A+B End Function Public Function Subtraction(double A, double B) As Double Subtraction=A-B End Function (2) compile it to a Addition.dll or to a *.dll file which contains both Addition and Subtraction? so that (3) in an Excel worksheet, we just use =Addition(C1, C2) To carry on a calculation? Thanks! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
With a slight change, you can put the functions in a regular module in
Excel's VB Editor and use it. The change is "A as Double" rather than "double A". A dll can't be made in Excel; VB, VB.NET, C++, etc. is needed. Hth, Merjet |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, Merjet.
But my need is to use dll instead using macro in order to hide the code. I have vb.net and can compile dll file for ASP use. For example, I only need specify the name space and add lot of #include system statement, put the dll file in the same folder or server, then the ASP can pick up all functions. For Excel, what are the procedures should I follow, and the objective is to use the use defined function just like the Excel buid-in functions such as =sum(C1:C10), =Median(C1:C10), etc. In the Macro VB, I can also directly call the dunction, like A=exp(10), etc. Thanks for your response. FindSolution "merjet" wrote: With a slight change, you can put the functions in a regular module in Excel's VB Editor and use it. The change is "A as Double" rather than "double A". A dll can't be made in Excel; VB, VB.NET, C++, etc. is needed. Hth, Merjet |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I haven't used vb.net. I've used VB6 to make a DLL, and guess it's
similar. So I will answer from that background. A DLL has one or more Public objects of which a calling application can make an instance of. The Public object will have properties and/or methods that can be used. For example, here are some lines of code from a project. Public moCntrl As Calm.Cntrl Set myCntrl = New Calm.Cntrl Calm is a DLL. Cntrl is a Public class which has several Public objects and methods. To use the DLL In Excel, it will need a reference in the VB Editor using the menu Tools | References. Hth, Merjet |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "FindSolution" wrote: Could some one provide a step-by-step instruction on: (1) Create a public function, such as Public Function Addition(double A, double B) As Double Addition=A+B End Function Public Function Subtraction(double A, double B) As Double Subtraction=A-B End Function (2) compile it to a Addition.dll or to a *.dll file which contains both Addition and Subtraction? so that (3) in an Excel worksheet, we just use =Addition(C1, C2) To carry on a calculation? Thanks! If you don't mind using C#: http://www.codeproject.com/dotnet/excelnetauto.asp -- urkec |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Call a batch file from an Excel Macro | Excel Discussion (Misc queries) | |||
Call a batch file from an Excel Macro | Excel Discussion (Misc queries) | |||
how can i call macro in powerpoint file from excel file | Excel Programming | |||
Create a Worksheet by getting datas from the txt file with Macro | Excel Programming | |||
Button fails to call macro when open an Excel file from web | Excel Programming |