michaelk Posted January 31, 2021 Share Posted January 31, 2021 I have a script that uses the current selected cell of the top visible worksheet. Once the script is done, is there a way to "reselect" the cell? Keyboard input immediately after the script runs operates on the drawing itself, not any cell in the worksheet. The dream goal is to select a cell, run a script, use the arrow keys to change cells, run another script. Quote Link to comment
Pat Stanford Posted January 31, 2021 Share Posted January 31, 2021 Have you tried PROCEDURE SetTopVisibleWS ( worksheet:HANDLE ) ; ?? You may have to also PROCEDURE SetWSCurrentCell( worksheet:HANDLE; currentCellRow:INTEGER; currentCellColumn:INTEGER) ; Quote Link to comment
michaelk Posted January 31, 2021 Author Share Posted January 31, 2021 Yes. Sorry, I should have mentioned what I tried. I tried SetTopVisibleWS(h), SetSelect(h), and SetWSCurrentCell(h,currentCellRow,currentCellColumn). Still when I run a script the next keyboard input is on the drawing, not the worksheet. Quote Link to comment
Julian Carr Posted January 31, 2021 Share Posted January 31, 2021 Pretty sure this is not possible as there is no VS procedure to change the focus and I think worksheet cell editing explicitly requires a click into a cell. I think you would need to use dialogs to enter your data and move to another cell, possibly with buttons to control which script is run next and other buttons to control the next cell to go to, etc. Not nearly as easy or workable though. Quote Link to comment
Julian Carr Posted January 31, 2021 Share Posted January 31, 2021 Actually one thing might work. If you run the script from a menu command, it might avoid removing focus from the worksheet, which is what clicking in a script palette is doing. You could use the RunScript command with a keyboard shortcut, then have your scripts in a folder if there is more than one. Alternatively create one or more .vsm's and put the script/s in that, then call them with keyboard shortcuts. If you do this, the only call you will need in the script is SetWSCurrentCell(h,currentCellRow,currentCellColumn); Quote Link to comment
michaelk Posted February 1, 2021 Author Share Posted February 1, 2021 Hi Julian Thanks! I never considered that the selecting the worksheet or worksheet cell wouldn't also change the focus. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.