I created a Module in an Excel workbook with this definition:
Public Function FIB(arg As Integer) As String
Dim jObject As New JDLLServerLib.JDLLServer
Dim rObject As Variant
Rem f0a from http://www.jsoftware.com/jwiki/Essays/Fibonacci%20Sequence
Status = jObject.Do("f0a=: 3 : 'if. 1<y do. (y-2) +&f0a (y-1) else. y
end.'
M.")
Status = jObject.DoR("f0a " & Str(arg), rObject)
FIB = Str(rObject)
jObject.Quit
End Function
I saved it and went back to the workbook. I entered
16
in A1. I entered
=FIB(A1)
In A2.
I entered
=FIB(A2)
in A3. Here is the content of A1:A3
16 987 8.34288E+205
This is presented as an example of what can be done. It is probably not the
best way to do it.
On 2/21/2011 13:11, Graham Parkhouse wrote:
> I didn't use cmd.exe the first time: I have now, but I still get the same
> error message when I run your macro, and it stops on the same line. I've
> only done it with J701 and everything is 32 bit.
>
> I have been looking up a lot of stuff on the internet, but am not greatly
> encouraged. It seems you have to register every macro, and then only if its
> written in C++, C#, F# or Jscript, and NOT the J script I'm looking for! I
> was hoping I could attach a script file to a directory containing my Excel
> file and get ready access to the functions in J. OK, I expect to reference
> each function, with name in Excel, name in J, argument types etc - no
> problems. But this seems beyond my reach at the moment.
>
> Gratefully
>
> Graham
>
> David Mitchell wrote:
>
>
>> Graham,
>>
>> You are welcome.
>>
>> The Excel help search shows several possible explanations for error
>> 429.
>>
>> I suspect that the most likely cause is that you may not have the
>> correct
>> version of J7 J.DLL registered for the version of Excel you are
>> running.
>>
>> All of the versions I currently have of Excel are 32 bit versions. I
>> did use a
>> beta version of 64 bit Excel for a while, but it expired.
>>
>> So, I make sure that I have registered the current 32 bit version of
>> J.DLL when
>> I use Excel.
>>
>> I believe you can register both the 32 and 64 bit version of J.DLL and
>> Win7 will
>> figure out which to use, but it has been a while since I tried that.
>>
>> So, the safest way is to make sure that the last version of J.DLL you
>> register
>> matches your version of Excel.
>>
> ------------------------------
>>
>> Message: 2
>> Date: Mon, 21 Feb 2011 10:45:30 -0500
>> From: David Mitchell<[email protected]>
>> Subject: Re: [Jprogramming] J embedded in Excel
>> To: Programming forum<[email protected]>
>> Message-ID:<[email protected]>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> One more thought. I always use a cmd window with Administrator
>> authority to run
>> regsvr32.
>>
>> On Win7, you can type
>>
>> cmd.exe
>>
>> in the search window of the command window. When you see cmd.exe show
>> up at the
>> top of the search window, right-click it and select "Run as
>> administrator".
>>
>> After answering Yes to the UAC prompt, you can then cd to the J bin
>> directory
>> and run regsvr32.
>>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm