You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Dale Bronk <db...@windscape.com> on 2002/12/12 16:08:49 UTC

Excel not calculating

New to the list and have search archives with no matches.  I have a very
basic test Excel sheet that two numbered cells and the third cell is simply
"cell_1 + cell_2".  My code loads the Excel sheet, changes the value in
cell_1, then saves it back out to the file.  When I load the file into
Excel, I see my changed value in cell_1, but Excel does not auto calculate
the formula cell so it still shows the old value.  I have Excel set to the
default auto calc and have even pressed F9 for manual calc.  The formula
cell simply does not recalculate until I actually click on the formula cell,
then click in the formula bar and then press f9.

How can I make POI flip whatever switch needs to be flipped to make Excel
recalculate all formula's in the workbook?  Without this, POI seems pretty
useless as a very good use of POI is to create Excel templates on the file
system, then use POI to fill in the "entry" cells from database values, and
then see calculated values.

Thanks,
Dale




RE: Excel not calculating

Posted by Dennis Doubleday <de...@righthandmanager.com>.
Sorry, I forgot to include:

    Application.ScreenUpdating = True

at the end of that sub. Kinda important :-)

> -----Original Message-----
> From: Dennis Doubleday [mailto:dennis@righthandmanager.com] 
> Sent: Thursday, December 12, 2002 10:35 AM
> To: 'POI Users List'
> Subject: RE: Excel not calculating
> 
> 
> I have the following in my templates:
> 
> Private Sub Workbook_Open()
>     Application.ScreenUpdating = False
>     'Make the entire workbook recalculate. Can be
>     'done with Application.CalculateFull in Excel2000
>     'but this is back-compatible to Excel97.
>     SendKeys "%^{F9}", True
> End Sub
> 
> Seems to work.
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:poi-user-> unsubscribe@jakarta.apache.org>
> For 
> additional commands, 
> e-mail: <ma...@jakarta.apache.org>
> 


RE: Excel not calculating

Posted by Dennis Doubleday <de...@righthandmanager.com>.
I have the following in my templates:

Private Sub Workbook_Open()
    Application.ScreenUpdating = False
    'Make the entire workbook recalculate. Can be
    'done with Application.CalculateFull in Excel2000
    'but this is back-compatible to Excel97.
    SendKeys "%^{F9}", True
End Sub

Seems to work.