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.

On 2/21/2011 10:03, 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.
>
> On 2/21/2011 9:24, Graham Parkhouse wrote:
>> Thanks, David!
>>
>> I've got the references dialogue box now thanks to your advice below, and
>> I've added j.dll to its list, which it shows as 'Jsoftware: JDLLServer Type
>> Library', and it's ticked. Great!
>>
>> But, running your macro gives
>>
>> Run-time error '429':
>> ActiveX component can't create object
>>
>> And the debugger highlights the line
>>
>> Status = jObject.DoR(("!"& Selection.Offset(0, 0).Value), rObject)
>>
>> Getting close!
>>
>> I can now write VBA functions in Excel. Nothing like mucking about in other
>> languages to raise one's appreciation of J.
>>
>> Thanks for your patience!
>>
>> Graham Parkhouse
>>
>> On Mon 21 Feb David Mitchell wrote:
>>>
>>> Graham,
>>>
>>> You may have to coax Excel to show the Macro options.
>>>
>>> In Excel 2007, I clicked on the circular bubble in the upper left
>>> corner of the
>>> main Excel window. I clicked on the button labeled 'Excel Options' in
>>> the lower
>>> right of the sub-window. I then clicked on 'Show Developer Tab in the
>>> Ribbon'.
>>>
>>> In Excel 2010, I right-clicked on an empty area of the 'ribbon' and
>>> selected
>>> 'Customize the Ribbon'. I then checked off 'Developer' under 'Main
>>> Tabs' or
>>> 'All Tabs'.
>>>
>>> Once you have the Developer tab, you can open up the Visual Basic
>>> window. Once
>>> there, the menu option Tools->References will show you the available
>>> references.
>>> If J7 has been registered, you should see an option like 'J DLL
>>> Server
>>> (Version 3) Type Library' that you can check off.
>>>
>>> The J code is a bit subtle. This is the line that calls J to execute a
>>> text
>>> expression:
>>>
>>> Status = jObject.DoR(("!"& Selection.Offset(0, 0).Value), rObject)
>>>
>>> The J verb used is !, concatenated to the Value from the selected Cell,
>>> returning a value to rObject.
>>>
>>> This should work with user defined J verbs as well, once they are
>>> defined.
>>> --
>>> Good luck,
>>> David Mitchell
>>>
>>> On 2/21/2011 7:51, Graham Parkhouse wrote:
>>>> How do I do step 3, add the Excel Macro Reference to
>>>>
>>>> Jsoftware: JDLLServer Type Library?
>>>>
>>>> And where is the J in your example? I can't see how entering 123 0
>>> should be
>>>> expected to result in 123 1.21E+205.
>>>>
>>>> Gratefully
>>>>
>>>> Graham Parkhouse
>>>>
>>>> ----------------------------------------------
>>>>
>>>> On Sat 19 Feb, 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
>>>>
>>>> ---------------------------------------------------------------------
>>> -
>>>> For information about J forums see
>>> http://www.jsoftware.com/forums.htm
>>>>
>>>
>>>
>>> ------------------------------
>>>
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>>>
>>> End of Programming Digest, Vol 65, Issue 46
>>> *******************************************
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to