Select Cell Range in Excel ActiveX

조회 수: 4 (최근 30일)
Glenn Kightley
Glenn Kightley 2012년 2월 29일
댓글: Jean OMB 2021년 7월 9일
Hi,
I'm hoping someone can help with a GUI i'm building that interacts with an Excel ActiveX object. I'm trying to get my GUI to report the RANGE which has been selected my the mouse, rather than the active cell which forms only one corner of the range.
has been some help, however the function:
ActRange = get(Spreadsheet1,'Range');
Does not appear supported, or if it is, I can't figure out how to extract the value e.g. 'a1:b5'
Does anyone know a work around?
Thanks in advance,
Glenn

채택된 답변

Friedrich
Friedrich 2012년 2월 29일
Hi,
as far as I know there is no function for that in EXCEL. You have to get it yourself with the Adress property of the Cell object:
selected_range = [strrep(ex.Selection.Cells.Item(1).Address,'$',''),':',strrep(ex.Selection.Cells.Item(ex.Selection.Cells.Count).Address,'$','')]
Here ex is the handle to the EXCEL automation server.
  댓글 수: 5
Image Analyst
Image Analyst 2013년 6월 23일
How do you propose to let the computer know that you have selected the final range? I mean, you could click on various cells, and even highlight some rectangles, before you decide to "go with" the current selection. How do you tell it you're ready to leave Excel and continue with your MATLAB code?
Jean OMB
Jean OMB 2021년 7월 9일
Hi, im learning on how to work with Activex and I was wonedering if any of you guys were able to open an excel file from matlab and select a range of cells with the mouse? if you did, can you show the code?Thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 ActiveX에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by