I think that Damien is using the J OLE server for Excel described in
http://www.jsoftware.com/help/user/tutorial_ole_server_excel.htm and
included in the system library at jpath '~system/examples/ole/excel' .
Richard Hill builds on this in his article "Using J in Excel"
http://www.jsoftware.com/jwiki/Articles/JExcel .
Using the functions there I am also unable to set a variable in J to the
values of an Excel cell range, unless that cell range is all numeric
(doesn't contain any empty or character cells, having all cells contain
string data doesn't work either). It returns an error code "3"
To me it seems that the Set method of the jexeserver object won't accept
anything other than all numeric ranges. I used the testset subroutine
below to try and set the variable jvar in the the J ijx session.
Public js As Object
Sub auto_open()
jxopen
jloadprofile
jshow 1
jlog 1
End Sub
Sub jxopen()
On Error GoTo Fini
Set js = CreateObject("jexeserver")
js.Quit
Fini:
End Sub
Sub jdo(s As String)
ec = js.do(s)
If ec Then MsgBox "Error code: " & Str(ec)
End Sub
Sub jloadprofile()
jdo "0!:0 <1!:45''"
End Sub
Sub jlog(b As Boolean)
js.Log b
End Sub
Sub jshow(b As Boolean)
js.Show b
End Sub
Sub jsetr(s As String, R As String)
v = ActiveSheet.Range(R).Value2
ec = js.Set(s, v)
If ec Then MsgBox "Error code: " & Str(ec)
End Sub
Sub testset()
jsetr "jvar", "A2:A5"
End Sub
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Damien
> Sent: Wednesday, 18 July 2007 06:02
> To: Programming forum
> Subject: Re: [Jprogramming] J OLE server for Excel
>
> My environment is excel.
> I fetch some data (like stock prices) from a data base, and
> import them with excel.
> Then I have to do some mathematical operations with this data
> and I would like to do these operations with J, not with
> excel BUT I need the operation results in excel.
> I succeeded in doing that when my data is homogenous that is
> to say numeric in my case.
> But when my data is not homogenous - empty cells or strings
> -, It does not work.
> Ex 3x3 matrix :
> 9 2 4
> 4 "blabla" 6
> 1 (empty) 3
> This is not an homogenous matrix. It happens sometimes in my
> case because of the data fetched.
> In this case, the piece of code shown below does not work.
> When I log J, nothing is displayed.
> Do you think the problem comes from the way I read the data
> with Excel ?
>
> regards,
> Damien
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm