[Solved] Cells selected after selecting active sheet ?

Creating a macro - Writing a Script - Using the API

[Solved] Cells selected after selecting active sheet ?

Postby oonk » Tue Dec 03, 2019 6:26 am

Code: Select all   Expand viewCollapse view
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 KDE of Fedora from Spins | LibreOffice 6.2.8.2-2 | Base with embedded HSQLDB |
oonk
 
Posts: 9
Joined: Fri Oct 04, 2019 8:03 am
Location: Pathum Thani, THAILAND

Re: Why are all cells selected after selecting active sheet

Postby FJCC » Tue Dec 03, 2019 6:56 am

I think this will get you what you want.
Code: Select all   Expand viewCollapse view
oSheet = ThisComponent.Sheets.getByName("Journal")
ThisComponent.CurrentController.setActiveSheet(oSheet)
Windows 10 and Linux Mint, since 2017
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
FJCC
Moderator
 
Posts: 7384
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Why are all cells selected after selecting active sheet

Postby oonk » Tue Dec 03, 2019 8:05 am

Thank you so much, that is really what I need.
| Fedora 31 Workstation KDE of Fedora from Spins | LibreOffice 6.2.8.2-2 | Base with embedded HSQLDB |
oonk
 
Posts: 9
Joined: Fri Oct 04, 2019 8:03 am
Location: Pathum Thani, THAILAND


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 2 guests