OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

how automatically select a spreadsheet after opening a docum

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
angman
General User
General User


Joined: 30 Jan 2006
Posts: 6

PostPosted: Mon Jan 30, 2006 9:32 am    Post subject: how automatically select a spreadsheet after opening a docum Reply with quote

Hi, I am a newbie on star basic, and I could not find a function to programmatically select a sheet, after openining a documentt.

Somebody can suggest me a solution.

Thanks. angman Rolling Eyes
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Mon Jan 30, 2006 1:33 pm    Post subject: Reply with quote

Wrong forum, but hey ...
Code:

Sub on_DocOpen()
REM uncomment in order to get second sheet (indices start at zero)
'oSheet = ThisComponent.getSheets.getByIndex(1)
REM uncomment in order to get a sheet by it's name
'oSheet = ThisComponent.getSheets.getByIndex("mySheetName")
  ThisComponent.CurrentController..setActiveSheet(oSheet)
End Sub

Save the code in some module of library "Standard" in the document in question and assign the "Doc Open"-event to Document > Standard > Module1 > on_DocOpen
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group