OpenOffice.org macro - getting a sheetlist

Soldato
Joined
26 Aug 2006
Posts
9,726
Location
62.156684,-49.781113
I'm trying to do a basic-ish accounts spreadsheet for my dad in OO.org Calc with each account on a page and then a summary page listing accounts, balances and an overall balance... Account sheets aren't particularly complicated, just summing the values and showing a balance in a specific cell.

The contents page is causing me more trouble though - I'm running a macro found on another site to get the list of sheets, defined as follows:

Code:
Function SHEETLIST() 
   SHEETLIST = thisComponent.getSheets.getElementNames() 
End Function

I've got this then transposed ("=transpose(sheetlist())") to produce the list vertically, done by hitting Ctrl+Shift+Enter to run the macro. Values can then be pulled from the sheet and are placed in the adjacent cells.

My problem comes when adding or removing a sheet - I can't seem to get the list to update without deleting the contents of the cells and re-entering the macro, something which takes away the ease of use for my dad!

Can someone point out how to make this easier? Can I add a button to refresh the macro or such? I've tried searching for this, but the terms are somewhat common.

May as well attach a copy of the version I've got so far: http://dl.dropbox.com/u/21332/Accounts.ods
 
Back
Top Bottom