View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default How to cancel the Edit status

Others making add-in with .Net/Interop /C++ have this problem, because code
is trying to run whilst Excel is in edit mode.
At best, this means values are meaningless or worst (as you have found out)
a crash.

You should not be forcing users out of edit mode. If I am writing a long and
complex formula, then you cancel it all because your code wants to run, you
will not have many users.
You need you code to run at the correct time and not allow users to enter
edit mode until Excel/system is ready.

Here's one way to detect if excel is in edit mode
http://groups.google.co.uk/group/mic...7a5175d41417d3

NickHK

"Kuoming" wrote in message
...
I use VC6 to write test data into excel file. The _Application, Workbooks,
_Workbook,Sheets and _Worksheet are initialized when program start, and

test
result can be writen correctly.
But when user double click one Cell on active sheet, this Cell will be in
edit stauts, the GetRange function will cause program crash.

Range myrange;
myrange = workSheet.GetRange(COleVariant(strLine),COleVarian t(strLine));

I try to use the SendKeys function to send "ESC", still couldn't change
foucs.
Kindly help how can I cancel the Edit status or How to disable the Edit
funtion.