Recalculation Done event?

L

Lavneet Singh

My application reads data from Excel workbook and, therefore, is hooked
to Excel (2003). Is there any API available to find if the
recalculation for the workbook (that my app uses) is over? Bascially, I
want to read data only once after recalculation in the workbook
finishes.
 
I

Ian

One way is to have a cell which changes value depending on the calculation
state.

eg
Range("A1").Value = 0
Worksheets("Sheet1").Calculate
Range("A1").Value = 1

Test the value of A1 before reading the data.
 
L

Leith Ross

Hello Lavneet Singh,

I am assuming since you are looking for APIs and say you are hooked
into Excel 2003 that your application is hooked into the messaging
system. The best approach I can think of would be to run Spyxx.exe to
see the messages being sent during recalculation. If you are using
Microsoft's SDK for C++ you have it already. If you are using some
other platform, there may be an equivalent program for the
application's language.

Sincerely,
Leith Ross
 
L

Lavneet Singh

Hi,

Thanks Leith Ross and Ian for your replies.

Ian: The recalculation could be triggered externally (by user, fo
example) too. In such a case, is there a way to find if recalculatio
is done?

Leith Ross: The application in question uses COM via .net interop (C#
that basically uses Excel APIs directly. We aren't listening to windo
message loop. Sorry for using a potentially misleading wor
('hooked').

Thanks,
Lavneet
 
I

Ian

Could you set a value such that, when the sheet is calculated, another cell
changes to a known value? eg set A2 as =A1 then change A1. Then test A2
before data transfer.
 
V

Vic Eldridge

Hi Lavneet,

Perhaps you could go by what's written in Excel's status bar.

If Left(Application.Statusbar,18) = "Calculating Cells:" then
'still calculating
End If

Although I'm not sure if you'll be able to access the property while the
workbook is busy calculating.



Regards,
Vic Eldridge
 

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