How to use VBS to manage LibreOffice Calc files?
5,615
Here is a script, adapted from https://www.openoffice.org/udk/common/man/tutorial/office_automation.html:
Set oSM = CreateObject("com.sun.star.ServiceManager")
Set oDesk = oSM.createInstance("com.sun.star.frame.Desktop")
Dim arg()
Set wb = oDesk.loadComponentFromURL("private:factory/scalc", "_blank", 0, arg)
Set oSheet = wb.CurrentController.ActiveSheet
oSheet.getCellByPosition(1, 2).String = "Hello world!"
MsgBox "The End"
Related videos on Youtube
Author by
kokbira
My store on Google Play (http://play.google.com/store/apps/developer?id=kokbir4) Play OpenLieroX (http://openlierox.net) Ask super users (http://superuser.com) Ask programmers (http://stackoverflow.com) Use portable apps with LiberKey (http://www.liberkey.com/)
Updated on September 18, 2022Comments
-
kokbira over 1 year
I am learning VBS scripts and someone gave me a code below, that works with Microsoft Excel. How to convert it to work with LibreOffice Calc?
Dim ObjExcel Call ExcelSetup("Sheet1") Sub ExcelSetup(sheetName) Set objExcel = CreateObject("Excel.Application") Set objwb = objExcel.Workbooks.Add Set objwb = objExcel.ActiveWorkbook.Worksheets(sheetName) Objwb.Name = "Sheet name for user" objwb.Activate objExcel.Visible = True objwb.Cells(1, 2).Value = "Hello world!" End Sub MsgBox "The End"
-
CharlieRB about 8 yearsDid you do any research? What have you tried?
-