Excel cell editing mode

T

timo

I'm developing software which transfers data from serialport to Excel sheet.
The problem is software crashing while cursor is in cell and data is written
to cell. In this project user MUST be able to modify/write cells sometimes.
This is what I'm gettin: Call was rejected by callee exception from HRESULT
0x8001001(rpc_e_call_rejected).
Is it possible to switch off cell editing mode while cursor is in cell ? I'm
talking about similar effect with pressing enter while cursor is in cell.
I'm using VB 2005 & Excel 2003.
 
N

NickHK

Many people seem to attempt this, but to me your code should check if Excel
is in a suitable state to respond before you attempt to write to a cell,
i.e. check if Excel is in Edit Mode.
There was a suggestion from MS that you can check the Application.Ready
property.
However, it is not available on XL2000 and below. Also, some reply that it
does not really work.

Another suggestion was to see if the File>New menu was enabled or not.

It is a very bad idea to force the user out of Edit Mode, as they may have
spent a long time entering a complex formula, only to lose everything
because you want to put a value in a cell.

NickHK
 
T

timo

In this case forcing user out of the Edit Mode would not be a big deal
because this software is made to very specific purpose only. Users of this
one would typically write only short comments about values of got from serial
port. Software only write in 2 columns, sample number and value of sample. I
was thinking if it was possible to switch off Edit Mode, I would switch it
off, do the transfer and switch it back to on. Off time would be very short
it wouldn't be any problem.
 
N

NickHK

There is Application.Interactive that may be suitable then. But I still say
you should only run your code when not in Edit Mode.

NickHK
 
T

timo

Application.Interactive caused immediately some kind of error. Ready didn't
work either. Perhaps your way is the best. Only thing left to try is checking
if the File>New menu is enabled. How can I do it ?
 
N

NickHK

You would probably get better help from one of NGs aim at Interop ;
microsoft.public.excel.sdk
microsoft.public.excel.interopoledde

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top