Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Select cell to remove text insertion point

I have set up calc basic macros to load the contents of a cell (which is a partial account name) when I type Enter, look up the "full" version of the account name from a table, and then save the full version back into the cell. This works great when the cell is selected and there is not an active insertion point in the text of the cell. But if I select the cell, type the partial account name (so that the flashing insertion point bar is still in the cell), then press Enter, the code runs, but when I SetString on the cell, the text appears to be "locked" - since it's being edited, I suppose - and the full version of the account name is NOT written back into the cell.

I tried selecting the cell before processing, but since it is already the active cell, selecting it appears to change nothing. I can select an adjacent cell, then go back to select the original cell, and then the code works fine, but I don't have a reliable way to easily identify a cell on the page that I can select that I know won't be locked. (And that's kind of a kludge anyway.)

What I would really like is a method of a cell that would tell it to "finish" any current editing going on, so that when I SetString back into the cell, it will "take". Does such a method exist? (I'm sure it most...) I have looked in the API documentation, but I find those docs kind of a mystery (and I'm a quite experienced programmer). I assume it would be related to SheetCell, but from that page where would I go to find what I need? (So an answer to my specific problem, but also a little bit of searching advice so that I can find my own answer in the future would both be appreciated!)

Thanks, Jeff