|
Hello Mark,
// Open the spreadsheet within the workbook. <== second worksheet sheet = hssf_getSheet(book: 'Summary'); ExSr $CellSummary; <== this writes my summary formula to the first worksheet, not to the second worksheet
When you open a workbook with HSSF_open() it reads the existing workbook into memory. When you access the various sheets and rows and cells and cellstyles (etc, etc) you're just accessing data in memory. (Just think of the workbook as a very complicated data structure, containing stuff like arrays of sheets, etc.) The point is, you're just accessing data in memory. There's nothing to "open". Saving it and reloading it shouldn't make any difference.
The way your code is written, it'll only work if the 'Summary' sheet already exists in the document. Is that the case?
You say that when you write the new cell, it appears on the wrong sheet. Can you show us the code that writes the new cell? Since that's where the problem is happening?
I'd also run the code in debug -- make sure that the number that's returned by hssf_getSheet(book: 'Summary') is the same number that you pass when you retrieve/add the row object that's being written to the wrong sheet.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.