Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Reference Excel cells in R1C1 style using ConvertFormula

229 views
Skip to first unread message

maltehof

unread,
Mar 17, 2011, 12:29:05 PM3/17/11
to
Hi,

I am interfacing Excel from Matlab by using ActiveX. I want to get the content of a cell by referencing it in the R1C1 style. I am trying with the ActiveX method ConvertFormula but I get an Error Messsage "Index =ActiveX VT_ERROR:".

Excel=actxGetRunningServer('Excel.Application'); %Excel must be running
Index=ConvertFormula(Excel,'R1C1','XlA1') %This fails
...
delete(Excel)

Things I discovered:
-Method Range cannot handle the R1C1 style

-The Cells method, used in Visual Basic for referencing cells in R1C1 style (e.g. ActiveSheet.Cells(1, 1).Select;), seems not to be available in Matlab Active X.

-The prototype of method ConvertFormula looks different in Matlab and in MS Help.
Matlab: Variant ConvertFormula(handle, Variant, XlReferenceStyle, Variant(Optional))
MS: http://msdn.microsoft.com/en-us/library/aa297823(v=office.10).aspx

Thanks in advance for help

Malte

Bryan

unread,
Jun 27, 2011, 1:36:04 PM6/27/11
to
Were you ever able to solve this problem? I am also trying to access Excel via ActiveX and would like to do so using R1C1 notation.

Thanks!

"maltehof" wrote in message <iltcsg$aqi$1...@ginger.mathworks.com>...

Junghak

unread,
Feb 3, 2012, 5:52:12 AM2/3/12
to
Hi,

Please refer to the following link

http://www.mathworks.com/matlabcentral/fileexchange/27182-excel-column-conversion/content/ExcelCol.m

I hope it is helpful

Junghak Ahn

agil...@gmail.com

"Bryan " <bdl...@gmail.com> wrote in message <iuaf24$60s$1...@newscl01ah.mathworks.com>...

Erik

unread,
Sep 11, 2012, 7:31:08 AM9/11/12
to
Instead of writing

ActiveSheet.Cells(row, col)

use

ActiveSheet.get('Cells', row, col)

Regards,
Erik

"maltehof" wrote in message <iltcsg$aqi$1...@ginger.mathworks.com>...

David

unread,
Sep 13, 2013, 12:48:07 PM9/13/13
to
Thanks for the help. Using the ActiveSheet.get('Cells',row,col), along with the "address" propery, I was able to select a specific row/col directly with R1C1 format:

xlSheet1.Range(xlSheet1.get('Cells',myRow,myCol).address).Select

where xlSheet1 is the matlab com reference to the excel sheet

Thanks,
Dave
===================


"Erik " <er...@ufl.edu> wrote in message <k2n7ds$bsu$1...@newscl01ah.mathworks.com>...
0 new messages