Using ActiveX Server with Excel

8 ビュー (過去 30 日間)
David O'Brien
David O'Brien 2015 年 6 月 23 日
コメント済み: David O'Brien 2015 年 6 月 30 日
Some background I've looked at: Excel 2010 Developers Reference. https://msdn.microsoft.com/en-us/library/office/ff197266(v=office.14).aspx
Unfortunately, there's not much explanation for someone new to ActiveX:
1. Does this calculate the last occupied column? Is there a significance to '4'? It seems like this line should never be changed.
robj = exlSheet1.Columns.End(4)
3. How can I just import the entire worksheet without knowing how big the worksheet is?
dat_range = ['A1:G' num2str(numrows)]; % Read to the last row
It looks like you need to know beforehand with 'A1:G'. I suppose I could put in an arbitrary value such as 'A1:ZZ'.

採用された回答

Gitesh Nandre
Gitesh Nandre 2015 年 6 月 24 日
編集済み: Gitesh Nandre 2015 年 6 月 25 日
1. That code is selecting the last cell (containing data) in the first column of the first worksheet of the excel.
4 is basically 'xldown' property. Check the following link:
and also check this link:
3. You can use just the following code if you want to use the whole worksheet data:
dat_range = exlSheet1.UsedRange
Also, note that when you use COM interface for excel through MATLAB, you mostly deal with VBA code and little MATLAB code.
  1 件のコメント
David O'Brien
David O'Brien 2015 年 6 月 30 日
Thanks for the sources and explanations!
I see. The xlsread was fine, but I wanted to try this ActiveX server to see if it speeds up reading multiple tabs with large amounts of data.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeActiveX についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by