[Solved] Cells selected after selecting active sheet ?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
oonk
Posts: 23
Joined: Fri Oct 04, 2019 8:03 am
Location: Pathum Thani, THAILAND

[Solved] Cells selected after selecting active sheet ?

Post by oonk »

Code: Select all

Option Explicit
'Based on https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=68059#p303317
Sub ChangeActiveSheet
	Dim oSheet As Object
	oSheet = ThisComponent.Sheets.getByName("Journal")
	ThisComponent.CurrentController.Select(oSheet)
End Sub
Sheet "Journal" shows, but all its cells are selected.
How can I move the cursor to only cell A1 in order to unselect all cells ?
Last edited by oonk on Tue Dec 03, 2019 8:10 am, edited 2 times in total.
| Fedora 31 Workstation Cinnamon of Fedora from Spins | LibreOffice 6.2.8.2-2 | Base with embedded Firebird |
FJCC
Moderator
Posts: 9274
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Why are all cells selected after selecting active sheet

Post by FJCC »

I think this will get you what you want.

Code: Select all

oSheet = ThisComponent.Sheets.getByName("Journal")
ThisComponent.CurrentController.setActiveSheet(oSheet)
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
oonk
Posts: 23
Joined: Fri Oct 04, 2019 8:03 am
Location: Pathum Thani, THAILAND

Re: Why are all cells selected after selecting active sheet

Post by oonk »

Thank you so much, that is really what I need.
| Fedora 31 Workstation Cinnamon of Fedora from Spins | LibreOffice 6.2.8.2-2 | Base with embedded Firebird |
Post Reply