Some additional notes.

1. I am using Excel 2010 and a .xlsm file to create the macro workbook.
2. I found that the Excel Macro browser gave me the macro name I needed to use 
in the J 'base run' command.

On 4/27/2011 23:40, Devon McCormick wrote:
> Thanks - I'll give this a try when I get back to work.
>
> Part of the problem is that I'm unable to set the security level low enough
> to avoid the "Enable macros?" prompt (I tried setting up an AutoRun and
> invoking it from the command line and ran into this problem).
>
> The really annoying thing is that my alternative was to attempt to deal with
> the C++ code - which wasted hours (attempting to track down an old version
> of Visual Studio 2003, but settling for VS 2005), then trying to compile
> only to discover I'm missing an "xlsWrapper" module.  The developer admits
> that one needs to use their customized development server in order to
> actually compile this code.
>
> So, I can't even get to plowing through the thousands of lines of C++
> required to accomplish a pretty simple task.
>
> On Wed, Apr 27, 2011 at 1:43 PM, David Mitchell<[email protected]>wrote:
>
>>
>>
>> On 4/27/2011 11:06, Devon McCormick wrote:
>>> Members of the Forum -
>>>
>>> Although I agree with this sentiment (from
>>> http://www.jsoftware.com/jwiki/Articles/JExcel):
>>>
>>>      "Don't you find it maddening when you have to use another tool, at
>> rare
>>> intervals, and you have to re-learn its inconsistencies? I do, so when I
>> use
>>> Excel, I try to use the bare minimum of Excel facilities, whether or not
>> it
>>> would be better to use more VBA and less J."
>>>
>>> There sometimes comes a time when one is forced to do the nasty and deal
>>> with VBA.  So, in order to avoid modifying someone else's C++ code, I'd
>> like
>>> to replace that code with some J.  However, to do this, I need to load
>> data
>>> into a spreadsheet, then run a VBA macro from within J.  I know how to
>> load
>>> the data (using either Tara or OLEExcel) but not how to invoke an
>> arbitrary
>>> macro.  I feel I ought to know this as I apparently wrote a long essay on
>>> using OLE with Excel to read and write data to and from Excel worksheets
>> (
>>> http://www.jsoftware.com/jwiki/Scripts/OLEExcel).
>>>
>>> However, my recent attempts to run an arbitrary piece of VBA code fail
>> with
>>> a "domain error" on "xlget'base activeworkbook'" in "xlwbws".
>>>
>>> Has anyone run arbitrary macros in spreadsheets?  Is there a more modern
>> way
>>> to do this than OLE?
>>>
>>> Thanks,
>>>
>>> Devon
>>>
>>
>> This works to run a macro called Main in a arbitrary Excel workbook  for
>> me:
>>
>> 0. load xlutil.ijs
>> 1. set JMACROS to the fully qualified name of my workbook containing a
>> macro.
>> 2. xlopen''
>> 3. xlshow 1
>> 4. xlcmd'base run ThisWorkbook.Main'
>>
>> --
>> David Mitchell
>> ----------------------------------------------------------------------
>> 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