I realize that my example does not create a function for use in an Excel formula, but it should not be difficult to create one if if you review this:
http://www.wikihow.com/Create-a-User-Defined-Function-in-Microsoft-Excel and use the examples given to create a user defined function that calls J and performs your needed calculations. On 2/19/2011 17:14, David Mitchell wrote: > Here is an example: > > 1. I went to the bin install directory for J701 and ran this: > > regsvr32 j.dll > > 2. I created this Excel macro: > > Sub Main() > Dim jObject As New JDLLServerLib.JDLLServer > Dim rObject As Variant > > Sheets("Sheet1").Select > Range("A1").Select > Status = jObject.DoR(("!"& Selection.Offset(0, 0).Value), rObject) > Range("B1").Select > Selection.Value = Str(rObject) > jObject.Quit > End Sub > > 3. I added the Excel Macro Reference to > > Jsoftware: JDLLServer Type Library > > 4. I entered this into cells A1 and B1 in the Workbook Sheet1 > > 123 0 > > 5. I ran the macro and got this in cells A1 and B1: > > 123 1.21E+205 > > -- > David Mitchell > > On 2/19/2011 16:26, David Mitchell wrote: >> Graham, >> >> You might find this helpful: >> >> http://www.jsoftware.com/jwiki/Scripts/JfromExcel >> >> -- >> Cheers, >> David Mitchell >> >> On 2/19/2011 15:57, Graham Parkhouse wrote: >>> It has been suggested to me by my engineering colleagues that if I could >>> embed some of my J functions in an Excel spreadsheet they could use them. >>> I've looked at what the labs say on dlls and the 5 wiki articles on Excel. I >>> suspect dlls are the way forward since I want bespoke J functions to become >>> available in Excel formulae, along with the standard functions Excel >>> provides. >>> >>> Has anybody got an example of an Excel file that has access to simple J >>> functionality and the .dll files that go with it that actually work? If they >>> could email them to me, I would be most grateful, as I need something like >>> that to get me fired up. >>> >>> I'm expecting to do this in J602. Would it be any easier in J7? >>> >>> Graham >>> >>> ---------------------------------------------------------------------- >>> For information about J forums see http://www.jsoftware.com/forums.htm >>> >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
