help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using COM interface to write to Excel


From: Michael Goffioul
Subject: Re: Using COM interface to write to Excel
Date: Thu, 5 Jul 2012 07:47:28 +0100

On Wed, Jul 4, 2012 at 11:41 PM, BinaryGirl <address@hidden> wrote:
Hello,

I have a Matlab program that I am trying to run in Octave.  While the
majority of my program runs smoothly, I'm having a few problems with the COM
interface.  I have installed both the i/o and windows packages, and my
program runs fine with the few trouble lines commented out.

The problem is basically that I can read from the Excel file, but I can't
write any data back.


For example, this line of code works fine:

storageName = infoSheet.Range('B7').Value;


However, when I want to write the same variable to a different worksheet in
the same workbook (yes, I created a handle to the worksheet already), the
following line causes an error:

addInfoSheet.Range('B1').Value = storageName;


This line of code worked fine in Matlab, so I'm under the impression that
Octave just doesn't support this particular command.  Is there a way I can
write data back out to my Excel file while it's still open using the COM
interface?  Or is my only option to close the actxserver and then re-open
the file using xlsopen and xlswrite?

Writing XLS files was definitely working when I wrote that code. For instance, the example file in the Windows package is writing an Excel file [1]. Could you try this instead:

r = addInfoSheet.Range('B1')
r.Value = storageName;

Michael.

[1] http://octave.svn.sourceforge.net/viewvc/octave/trunk/octave-forge/extra/Windows/examples/mat2xls.m?revision=4585&view=markup

reply via email to

[Prev in Thread] Current Thread [Next in Thread]