ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   user editing cell when code runs (https://www.excelbanter.com/excel-programming/421783-user-editing-cell-when-code-runs.html)

lahd

user editing cell when code runs
 
Hello

I'm not sure about the terminology, but my situation is that a user is in
the middle of editing the contents of a cell and then clicks on a toolbar
button, and interacts with a custom form - causing the program to either
write the "open" cell (the cell currently being edited) or create a new sheet
in the workbook. In either case the operation throws an exception.

Is there a command that I can use to tell excel to end the user edit? That
way I can end the edit prior to running any of my custom forms and thus avoid
the problem - rather than handling exceptions everywhere.
Thanks in advance
Dave

lahd

user editing cell when code runs
 
No ideas from anyone? Really? Not even help with the language? What do you
call the state of the system when the user is in the middle of editing a cell?

Dave Peterson

user editing cell when code runs
 
I call it edit mode.

Jan Karel Pieterse posted this. I think it should work in xl2003 and below.
I'm not sure what you'd check in xl2007's ribbon.


When XL is in editing mode, certain menu items are disabled. You could check for
the enabled property of them.

E.g.:

Sub Editing()
If Application.CommandBars(1).FindControl(ID:=23, _
recursive:=True).Enabled = False Then
MsgBox "Editing"
Else
MsgBox "Not editing"
End If
End Sub


=========
Maybe you can check that status before your code does anything.



lahd wrote:

No ideas from anyone? Really? Not even help with the language? What do you
call the state of the system when the user is in the middle of editing a cell?


--

Dave Peterson

Jim Rech

user editing cell when code runs
 
How do you run that macro when you're in edit mode, Dave? Aren't macros
disabled then? The only way I recall "achieving" that was with a Windows
API callback ontime function. I think it crashed Excel<g.

--
Jim
"Dave Peterson" wrote in message
...
|I call it edit mode.
|
| Jan Karel Pieterse posted this. I think it should work in xl2003 and
below.
| I'm not sure what you'd check in xl2007's ribbon.
|
|
| When XL is in editing mode, certain menu items are disabled. You could
check for
| the enabled property of them.
|
| E.g.:
|
| Sub Editing()
| If Application.CommandBars(1).FindControl(ID:=23, _
| recursive:=True).Enabled = False Then
| MsgBox "Editing"
| Else
| MsgBox "Not editing"
| End If
| End Sub
|
|
| =========
| Maybe you can check that status before your code does anything.
|
|
|
| lahd wrote:
|
| No ideas from anyone? Really? Not even help with the language? What
do you
| call the state of the system when the user is in the middle of editing a
cell?
|
| --
|
| Dave Peterson


lahd

user editing cell when code runs
 
Well, I've got a toolbar (which happens to be a VSTO add-in) and I can start
editing a cell then click on a toolbar button.

Thanks for the answer Dave


"Jim Rech" wrote:

How do you run that macro when you're in edit mode, Dave? Aren't macros
disabled then? The only way I recall "achieving" that was with a Windows
API callback ontime function. I think it crashed Excel<g.

--
Jim
"Dave Peterson" wrote in message
...
|I call it edit mode.
|
| Jan Karel Pieterse posted this. I think it should work in xl2003 and
below.
| I'm not sure what you'd check in xl2007's ribbon.
|
|
| When XL is in editing mode, certain menu items are disabled. You could
check for
| the enabled property of them.
|
| E.g.:
|
| Sub Editing()
| If Application.CommandBars(1).FindControl(ID:=23, _
| recursive:=True).Enabled = False Then
| MsgBox "Editing"
| Else
| MsgBox "Not editing"
| End If
| End Sub
|
|
| =========
| Maybe you can check that status before your code does anything.
|
|
|
| lahd wrote:
|
| No ideas from anyone? Really? Not even help with the language? What
do you
| call the state of the system when the user is in the middle of editing a
cell?
|
| --
|
| Dave Peterson



Dave Peterson

user editing cell when code runs
 
I never have.

So I'm glad lhad answered!

Jim Rech wrote:

How do you run that macro when you're in edit mode, Dave? Aren't macros
disabled then? The only way I recall "achieving" that was with a Windows
API callback ontime function. I think it crashed Excel<g.

--
Jim
"Dave Peterson" wrote in message
...
|I call it edit mode.
|
| Jan Karel Pieterse posted this. I think it should work in xl2003 and
below.
| I'm not sure what you'd check in xl2007's ribbon.
|
|
| When XL is in editing mode, certain menu items are disabled. You could
check for
| the enabled property of them.
|
| E.g.:
|
| Sub Editing()
| If Application.CommandBars(1).FindControl(ID:=23, _
| recursive:=True).Enabled = False Then
| MsgBox "Editing"
| Else
| MsgBox "Not editing"
| End If
| End Sub
|
|
| =========
| Maybe you can check that status before your code does anything.
|
|
|
| lahd wrote:
|
| No ideas from anyone? Really? Not even help with the language? What
do you
| call the state of the system when the user is in the middle of editing a
cell?
|
| --
|
| Dave Peterson


--

Dave Peterson

Dave Peterson

user editing cell when code runs
 
Or lahd.

Sorry.

Dave Peterson wrote:

I never have.

So I'm glad lhad answered!

Jim Rech wrote:

How do you run that macro when you're in edit mode, Dave? Aren't macros
disabled then? The only way I recall "achieving" that was with a Windows
API callback ontime function. I think it crashed Excel<g.

--
Jim
"Dave Peterson" wrote in message
...
|I call it edit mode.
|
| Jan Karel Pieterse posted this. I think it should work in xl2003 and
below.
| I'm not sure what you'd check in xl2007's ribbon.
|
|
| When XL is in editing mode, certain menu items are disabled. You could
check for
| the enabled property of them.
|
| E.g.:
|
| Sub Editing()
| If Application.CommandBars(1).FindControl(ID:=23, _
| recursive:=True).Enabled = False Then
| MsgBox "Editing"
| Else
| MsgBox "Not editing"
| End If
| End Sub
|
|
| =========
| Maybe you can check that status before your code does anything.
|
|
|
| lahd wrote:
|
| No ideas from anyone? Really? Not even help with the language? What
do you
| call the state of the system when the user is in the middle of editing a
cell?
|
| --
|
| Dave Peterson


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 02:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com