YES, this worked fine!  Thanks, Daniel!
-- John

----- Original Message ----- From: "Daniel Rentz" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, June 20, 2005 12:11 PM
Subject: Re: [users] Macro for navigation in Calc


John Viestenz schrieb:
Using OOo1.1.4 (Calc) on WinXP:
I'm having trouble getting a "navigation macro" to work. I want to be able to have this macro executed from buttons on various sheets (all of which exist) in a Calc document that is already open on the user's screen. When running the below macro (StarBasic), I get no error messages, but I also get no movement on the screen. The active sheet does not change to the desired "Another" sheet. Sub TestOne
 ' Trying to access a specific (existing) sheet, by name,
 '      using a macro (assigned to a push-button on a
' different sheet in the same file). ' Run from already-open spreadsheet, but not from
 '     the sheet named "Another".
 ' ' I want the visible spreadsheet to change from the
 '    existing sheet, to the sheet "Another".
 Dim Doc As Object
 Dim Sheet as Object
 Doc = StarDesktop.CurrentComponent
 Sheet = Doc.Sheets.getByName("Another")
 ' No errors when macro runs, but nothing happens on the screen
 Sheet.IsVisible = true
 ' Still nothing happens...

This changes the "hidden state" of the sheet (in Calc: Format->Sheets->Hide or ->Show).


To "activate" a sheet, you can use the following:

oDoc = ThisComponent
oSheet = oDoc.Sheets.getByName( "Another" )
oDoc.CurrentController.ActiveSheet = oSheet


Best regards
Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to