使用(TCL)TCOM如何select完整的相邻单元格范围?

需要select一个完整的范围(固定从一个单元开始,但可以向左或向右延伸)

以下代码工作正常,并select表格的最后一行和最后一列从单元格B2开始(第2行第B列)

#already opened handle to excel app set appHandle ::tcom::handle0x04C65180 [[$appHandle Range B2] Select set xlToRight -4161 [[$appHandle Selection] End $xlToRight] Select set xlDown -4121 [[$appHandle Selection] End $xlDown ] Select 

但它不是select细胞。 有没有任何方法select这个范围。

它看起来像一个粗糙的黑客

 #Following proc returns alphabet character for column number proc colName {col} { return [format %c [expr [scan A %c] + ($col%26) - 1]] } set endCol [colName [[[$appHandle Range B2] End $xlToRight] Column]] set endRow [[[$appHandle Range B2] End $xlDown] Row] [$appHandle Range B2 $endCol$endRow] Select