What is the genuine shortcut key for turning off editing mode in MS Excel? Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Sabestian Caine
Posts: 480
Joined: 12 Apr 2015, 03:53

What is the genuine shortcut key for turning off editing mode in MS Excel?

08 Feb 2017, 01:32

Friends. as there is f2 key for turning on editing mode in ms excel, I wish to know- is there any built in shortcut key for turning off editing mode in ms excel? I know that all the arrow keys, enter, tab, esc are the keys which can turn off the editing mode. But I think these keys' genuine purpose is not to disable editing mode in excel sheet. So I mean to say is that- there must be any default shortcut key to disable or turn off the editing mode. Please help me.


THANKS A LOT...
I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: What is the genuine shortcut key for turning off editing mode in MS Excel?

08 Feb 2017, 07:14

I rarely use Excel nowadays. I believe you can toggle this using F2.
In Excel 2003 I used ImageSearch to find the toggle state (e.g. Edit/Enter).

In this example I introduced reliable delete previous/next word functionality to Excel:

Note: you would need an image corresponding to 'Enter' in the bottom-left corner.

Code: Select all

$^Backspace:: ;excel - text functions - ctrl+backspace/ctrl+del functionality
vPath = %A_ScriptDir%\Exe\z xl enter 03.bmp
ImageSearch, vPosX, vPosY, 0, 0, A_ScreenWidth, A_ScreenHeight, %vPath%
if (ErrorLevel = 0) ;0=image found, 1=image not found
SendInput {F2}
SendInput ^+{Left}{Del}
if (ErrorLevel = 0)
SendInput {F2}
JEE_RetX()

$^Del:: ;excel - text functions - ctrl+backspace/ctrl+del functionality
vPath = %A_ScriptDir%\Exe\z xl enter 03.bmp
ImageSearch, vPosX, vPosY, 0, 0, A_ScreenWidth, A_ScreenHeight, %vPath%
if (ErrorLevel = 0)
SendInput {F2}
SendInput ^+{Right}{Del}
if (ErrorLevel = 0)
SendInput {F2}
JEE_RetX()
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Sabestian Caine
Posts: 480
Joined: 12 Apr 2015, 03:53

Re: What is the genuine shortcut key for turning off editing mode in MS Excel?

08 Feb 2017, 23:55

thanks dear jeeswg....
but i want any shortcut key for turning off editing mode....
plz help..
I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.
4GForce
Posts: 553
Joined: 25 Jan 2017, 03:18
GitHub: 4GForce

Re: What is the genuine shortcut key for turning off editing mode in MS Excel?

09 Feb 2017, 00:47

Looks like you need Microsoft support, not AutoHotKey ...

Still you could try this small script, double tapping F2 will send a Tab, Shift+Tab so you exit editing and keep the same cell selected.

Code: Select all

#singleinstance force

Esc::
ExitApp

~F2::
	if(A_ThisHotkey == A_PriorHotKey AND A_TimeSincePriorHotkey < 300) {
		send {Tab}+{Tab}
	}
	else {
		send {F2}
	}
Return
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: What is the genuine shortcut key for turning off editing mode in MS Excel?

09 Feb 2017, 07:58

I did some tests on Excel 2007.
In the bottom-left corner,
modes I often see are Ready/Edit/Enter.
'Tab, shift+tab' seemed to work well.
'Esc' might also be an answer, or part of an answer.

In the past on AutoHotkey Basic,
I used ImageSearch, to get the text of the item (Ready/Edit/Enter).
The Acc library (and AccViewer) can retrieve that
text programmatically if it's needed,
on Excel 2007. Perhaps on earlier/later versions too.

Acc library (MSAA) and AccViewer download links - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=6&t=26201
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Gicu
Posts: 111
Joined: 19 Aug 2014, 08:19
Location: Italy

Re: What is the genuine shortcut key for turning off editing mode in MS Excel?

09 Feb 2017, 10:25

Sabestian Caine wrote: but i want any shortcut key for turning off editing mode....
{Esc}
FanaticGuru
Posts: 1474
Joined: 30 Sep 2013, 22:25

Re: What is the genuine shortcut key for turning off editing mode in MS Excel?  Topic is solved

09 Feb 2017, 14:13

{Esc} cancels edit mode without accepting changes.
{Enter} leaves edit mode with changes accepted and moves to the next cell.
{Control}{Enter} leaves edit mode with change accepted and stays in the same cell.

I find the {Control}{Enter} the most useful for AHK scripts that need to make sure Excel is not in edit mode before it starts working on the active cell.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers
User avatar
Xeo786
Posts: 269
Joined: 09 Nov 2015, 02:43
Location: Karachi, Pakistan

Re: What is the genuine shortcut key for turning off editing mode in MS Excel?

10 Feb 2017, 02:41

FanaticGuru wrote:{Esc} cancels edit mode without accepting changes.
{Enter} leaves edit mode with changes accepted and moves to the next cell.
{Control}{Enter} leaves edit mode with change accepted and stays in the same cell.

I find the {Control}{Enter} the most useful for AHK scripts that need to make sure Excel is not in edit mode before it starts working on the active cell.

FG
following function determines is active excel workbook in edit mode or not?? :D

Code: Select all

msgbox, % IsEditing()
return

IsEditing()
{
        Try
		{
            ComObjActive("Excel.Application").Interactive := False
            ComObjActive("Excel.Application").Interactive := True
		}
        Catch
		{
            Return True
		}
        Return False
} 
"When there is no gravity, there is absolute vacuum and light travel with no time" -Game changer theory
User avatar
Sabestian Caine
Posts: 480
Joined: 12 Apr 2015, 03:53

Re: What is the genuine shortcut key for turning off editing mode in MS Excel?

12 Feb 2017, 11:59

Thanks dear 4GForce, jeeswg, Gicu, Fanaticguru, Xeo786....
Fanaticguru really solved my problem and the real key is ctrl+enter......
Thanks you all for your great help.....


Thanks a lot all of you once again........
I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.
JJohnston2
Posts: 193
Joined: 24 Jun 2015, 23:38

Re: What is the genuine shortcut key for turning off editing mode in MS Excel?

12 Feb 2017, 22:38

I stumbled upon the same solution recently (Ctrl+Enter) trying to get Jethrow's accessibility function to work more reliably when retrieving a reference to an Excel window in edit mode.

I took the following approach (this particular syntax requires a separate function for ControlGetFocus())

Code: Select all

    xlWinTitle:="ahk_class XLMAIN"
    If (ControlGetFocus()="Excel61") && HitEnterIfEditing:=True
        ControlSend, Excel61, % "^{Enter}", % xlWinTitle
    ControlGet, myHwnd, Hwnd, , Excel71, % xlWinTitle
    xlWindow := Acc_ObjectFromWindow(myHwnd, -16)             ; requires Acc.ahk library 
FanaticGuru
Posts: 1474
Joined: 30 Sep 2013, 22:25

Re: What is the genuine shortcut key for turning off editing mode in MS Excel?

13 Feb 2017, 13:22

Xeo786 wrote:following function determines is active excel workbook in edit mode or not?? :D

Code: Select all

msgbox, % IsEditing()
return

IsEditing()
{
        Try
		{
            ComObjActive("Excel.Application").Interactive := False
            ComObjActive("Excel.Application").Interactive := True
		}
        Catch
		{
            Return True
		}
        Return False
} 
Just for the record there is nothing magical about ComObjActive("Excel.Application").Interactive even though it sounds like it has something to do with Edit Mode.

You could just as easily do ComObjActive("Excel.Application").Range("A1"). Lots of commands cause an error from Excel when in Edit Mode. Range is also probably better as you are only getting information, not setting information, as a test. Interactive is a pretty invasive command and also the function sets it to True regardless of what the user may have set it outside the function.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers
User avatar
Sabestian Caine
Posts: 480
Joined: 12 Apr 2015, 03:53

Re: What is the genuine shortcut key for turning off editing mode in MS Excel?

14 Feb 2017, 00:37

FanaticGuru wrote:
Xeo786 wrote:following function determines is active excel workbook in edit mode or not?? :D

Code: Select all

msgbox, % IsEditing()
return

IsEditing()
{
        Try
		{
            ComObjActive("Excel.Application").Interactive := False
            ComObjActive("Excel.Application").Interactive := True
		}
        Catch
		{
            Return True
		}
        Return False
} 
Just for the record there is nothing magical about ComObjActive("Excel.Application").Interactive even though it sounds like it has something to do with Edit Mode.

You could just as easily do ComObjActive("Excel.Application").Range("A1"). Lots of commands cause an error from Excel when in Edit Mode. Range is also probably better as you are only getting information, not setting information, as a test. Interactive is a pretty invasive command and also the function sets it to True regardless of what the user may have set it outside the function.

FG


:thumbup: :thumbup: :thumbup: :thumbup: :thumbup: :thumbup: :thumbup: :thumbup: :thumbup: :thumbup: :thumbup: :thumbup:
I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.

Return to “Ask For Help”

Who is online

Users browsing this forum: haichen, julianpa, RubbeH, Senior47 and 42 guests