Reputation: 3082
In the Office.js API I see a Range.select()
method, but is there anyway to deselect whatever is currently selected on the spreadsheet?
My add-in has an onSelectionChanged listener which listens for when a cell is selected and reacts accordingly. However, if a cell is selected first, then my add-in is launched, and then they click again on the same cell that was already selected, nothing happens (because the selection didn't change).
Thus, when my add-in is launched, I'd like to clear all selections so it will behave accordingly when the user makes any selection.
Upvotes: 1
Views: 318
Reputation: 33124
In Excel, there is always a selected cell.
You're best bet then is to reset their selection A1
. This doesn't completely resolve the issue but does reduce the chances of a user running into it. The assumption being that A1 is less likely to contain something the user wants to look up (i.e. it's almost always a label).
Upvotes: 2