Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Am 03.02.2012 21:18, Dan Lewis wrote:

      Might there be another method? I just unzipped a Calc spreadsheet.
Then I looked at the Context.xml. I found:
"<table:table table:name =" (tab name) .
  Could this help some?

--Dan



Well, for someone who loves when others write free code, using a text editor is totally inacceptable. A double-click on the sheet tab is too much, same with Alt-click on the sheet tab since you have to type the sheet name. All this is too cumbersome for today's computer wimps. During the hours they beg for code snippets they could rename thousands of sheets manually. Now he has plonked me, I hope that he will not notice the following snippet which does a better job for hundreds of sheets starting at the active one.

Sub NameMonthSheets()
REM you may modify the following format string for the sheet names:
Const cOutFormat = "YYYY-MMM"

sm = InputBox("Starting with the active sheet, subsequent sheets will be renamed to months like """& _
format(Now(),cOutFormat)&""""& chr(10)& _
"Please enter the start month as 2 numbers with a dash (YYYY-MM)","macro RenameMonthSheets()", _
format(Now(),"YYYY-MM")
on error goto noInputErr
        dStart = cdate(sm &"-01")
on error goto 0
im = Month(dStart)
iy = Year(dStart)
ish = ThisComponent.CurrentController.ActiveSheet.RangeAddress.Sheet
for i = ish to ThisComponent.Sheets.getCount()-1
        x = im mod 12
        if x = 0 then
                x =12
        elseif (x = 1)and(i > ish) then
                iy = iy +1
        endif
        With ThisComponent.Sheets.getByIndex(i)
                .setName(format(cDate(iy &"-"& x  &"-01"),cOutFormat))
        end with
        im = im +1
next
noInputErr:
End Sub


--
For unsubscribe instructions e-mail to: users+help@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.