How to detect the workbook saved property, when the cell is changing??

Add-in Express™ Support Service
That's what is more important than anything else

How to detect the workbook saved property, when the cell is changing??
the cell is changing and the cursor leave this cell. 
Weipeng Hou




Posts: 8
Joined: 2006-09-22
I have a issue, when I change the cell and leave the cursor in this cell, I do not get get the correct saved property.
Posted 22 Sep, 2006 03:33:37 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Weipeng.

You just need to use the SendKeys method of the Excel application to disable the edit mode.

ExcelApp.SendKeys("~", true);
Posted 22 Sep, 2006 08:43:58 Top
Weipeng Hou




Posts: 8
Joined: 2006-09-22
Hi Sergey,
Thanks for your respond.
I try to use this method,but when I execute "SendKeys("~", true)" method, it can move the cursor, but I get the saved property of the workbook is still true.Actually, I have changed the document.Could you tell me why?

Thanks,
Weipeng
Posted 23 Sep, 2006 01:32:52 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Weipeng,

I think this happens because Excel needs some time to process the SendKeys method. You can try to use a code like the following:


uses Dialogs;

procedure TAddInModule.adxCommandBar1Controls0Click(Sender: TObject);
begin
  ExcelApp.SendKeys('^{ENTER}', True);
  Timer1.Enabled := True;
end;

procedure TAddInModule.Timer1Timer(Sender: TObject);
begin
  Timer1.Enabled := False;
  if ExcelApp.ActiveWorkbook.Saved[adxLCID] then
    ShowMessage('TRUE')
  else
    ShowMessage('FALSE');
end;


Posted 25 Sep, 2006 07:36:05 Top