Hello All,
I am trying to Access Calc Sheets with the following call:
Sheet = Doc.Sheets.getByName("CompanyA")
But, I wan't to Access the sheet with a reference, instead of a hard coded value. Like the following;
Dim CName As String
CName = "CompanyA"
Sheet = Doc.Sheets.getByName(CName)
This does not work. I tried using value(CName) which did not help either. Can I? How?
Nope, I dont want to lock myself to Sheet = Doc.Sheets(n) as it brings complications in the Management of the Doc.
Thanks in advance.
Gürkan
[Solved] Sheets - getByReference
[Solved] Sheets - getByReference
Last edited by RoryOF on Fri Jun 14, 2019 11:07 pm, edited 2 times in total.
Reason: Added green tick [RoryOF, Moderator]
Reason: Added green tick [RoryOF, Moderator]
LibreOffice 6.3
Re: Sheets - getByReference
Pare down to the minimum - Close everything. Open a new doc. Put your code in the main sub with the sheet changed to "Sheet1". What error message do you get if you get one? What do you mean by it doesn't work?
Edit:oops changed Doc to thisComponent
Code: Select all
sub Main
Dim CName As String
CName = "Sheet1"
Sheet = ThisComponent.Sheets.getByName(CName)
end sub
Last edited by JeJe on Fri Jun 14, 2019 9:59 am, edited 1 time in total.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Sheets - getByReference
If these sheets were originally in .xls format (as the mention of Access might lead us to suspect), then there could be a legacy problem, much as we see in Writer when files have been saved in, or originate in, .doc format.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Re: Sheets - getByReference
Switched to LibreOffice 6.2.
It works perfectly fine now.
Thanks
It works perfectly fine now.
Thanks
LibreOffice 6.3