[Solved] Sheet active (visible) in VB.NET
[Solved] Sheet active (visible) in VB.NET
I have an ODS saved with tab 0 active.
What command in VB.NET makes another tab active (visible)?
What command in VB.NET makes another tab active (visible)?
Last edited by Hagar Delest on Mon Jun 13, 2022 8:17 pm, edited 1 time in total.
Reason: tagged solved.
Reason: tagged solved.
OpenOffice 3.1 on Windows Vista
Re: Sheet active (visible) in VB.NET
Do you want to create AOO/LO Macros? That uses the API and (mostly) the StarBasic. You can control the application by the API functions from other developing environments, but not by any VB.NET "commands". You must study the API functions of the AOO and LO.
API: Application Programming Interface
LO: LibreOffice
AOO: Apache OpenOffice
API: Application Programming Interface
LO: LibreOffice
AOO: Apache OpenOffice
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Sheet active (visible) in VB.NET
What software and version are you using really? AOO or LO? Please update your signature in this Forum.____________________________________
OpenOffice 3.1 on Windows Vista
Last edited by Zizi64 on Mon Jun 13, 2022 4:24 pm, edited 1 time in total.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Re: Sheet active (visible) in VB.NET
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Sheet active (visible) in VB.NET
I'm using LibreOffice 6.0 and VB.NET Express 2019.
Test the code below and it didn't work. Have another tip?
Test the code below and it didn't work. Have another tip?
Dim oSM 'Root object for accessing OpenOffice from VB
Dim oDesk, oDoc As Object 'First objects from the API
Dim arg(1) As Object 'Used as parameter in opening doc
Dim LCSV1, LCSVX, LXXX() As String
'
Dim FILECSV As String = "D:\TESTEX.CSV"
Dim FILEODS As String = "D:\TESTEX.ODS"
'
oSM = CreateObject("com.sun.star.ServiceManager") 'Instantiate Open Office for VB
oDesk = oSM.createInstance("com.sun.star.frame.Desktop") 'Create service
oDoc = oDesk.loadComponentFromURL("file:///" & Replace(FILEODS, "\", "/"), "_blank", 0, arg) 'Open an existing doc, note no index on arg parameter
'
FileOpen(1, FILECSV, Microsoft.VisualBasic.OpenMode.Input)
LCSV1 = LineInput(1)
LXXX = LCSV1.Split(CType(";", Char()))
'
Dim oSheet0 As Object
oSheet0 = oDoc.getSheets().getByIndex(0) 'Get first sheet
Dim B6 As String = Mid(LXXX(1), 4)
Call oSheet0.getCellByPosition(1, 5).SetString(B6)
'
Dim X As Integer = Int(Mid(LXXX(0), 3))
Dim oSheetX As Object
oSheetX = oDoc.getSheets().getByIndex(X) 'Get sheet perimetro_x
'
oSheet0.IsVisible = True '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
oSheet0.IsActive = True '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'
Dim LL As Integer = 11
While Not EOF(1)
LCSVX = LineInput(1)
LXXX = LCSVX.Split(CType(";", Char()))
Call oSheetX.getCellByPosition(0, LL).SetString(LXXX(0)) 'Enter string value in selected cells(Col, Row) 'Cell Entry Options – SetValue(123) SetString(“ABC”) SetFormula(“=SUM(A1:E4)”)
Call oSheetX.getCellByPosition(1, LL).SetString(LXXX(1))
Call oSheetX.getCellByPosition(2, LL).SetString(LXXX(2))
Call oSheetX.getCellByPosition(3, LL).SetString(LXXX(3))
Call oSheetX.getCellByPosition(4, LL).SetString(LXXX(4))
Call oSheetX.getCellByPosition(5, LL).SetString(LXXX(5))
Call oSheetX.getCellByPosition(6, LL).SetString(LXXX(6))
Call oSheetX.getCellByPosition(7, LL).SetString(LXXX(7))
Call oSheetX.getCellByPosition(8, LL).SetString(LXXX(8))
Call oSheetX.getCellByPosition(9, LL).SetString(LXXX(9))
Call oSheetX.getCellByPosition(10, LL).SetString(LXXX(10))
Call oSheetX.getCellByPosition(11, LL).SetString(LXXX(11))
LL = LL + 1
End While
FileClose(2)
'
'Save the doc
Call oDoc.store()
'
MsgBox(“Program Finished”)
OpenOffice 3.1 on Windows Vista
Re: Sheet active (visible) in VB.NET
That code should work no matter which sheet is visible. It writes to the first sheet.
Change the sheet index if you want to write to any other sheet.
Code: Select all
oSheet0 = oDoc.getSheets().getByIndex(0) 'Get first sheet
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Sheet active (visible) in VB.NET
This code informed is already in my program and is working.
What I need is for the tab being recorded to be visible to the user.
What I need is for the tab being recorded to be visible to the user.
OpenOffice 3.1 on Windows Vista
Re: Sheet active (visible) in VB.NET
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Sheet active (visible) in VB.NET
What is not working is the following code.
oSheet0.IsVisible = True '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
oSheet0.IsActive = True '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
OpenOffice 3.1 on Windows Vista
Re: Sheet active (visible) in VB.NET
In OpenOffice Basic
Code: Select all
oDoc.CurrentController.setActiveSheet(oSheet0)
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.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Re: Sheet active (visible) in VB.NET
FOR HEAVENS SAKE, WE ARE NOT HUMAN MACRO RECORDERS!
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Sheet active (visible) in VB.NET
Excellent, perfect, it worked.oDoc.CurrentController.setActiveSheet(oSheet0)
Very grateful to everyone.
OK.
OpenOffice 3.1 on Windows Vista