N/APosted on - 01/30/2013
Hi, I am a newly Vbscript programmer and I would like to OpenOffice base in Vbscript workbook containing 8 worksheets, and can access worksheet 1 and worksheet 8 of that workbook using Vbscript.
Can you please show me how doing this in a way that I can understand?
Can I use Openoffice base in vbscript?
Use OpenOffice.org a Microsoft product that works on many different platforms. You will be able to use scripts to execute your programs and manage your office through programming languages such as: Visual Basic, C++, Delphi, VBscript and JScript. Internet Explorer and Windows Script Host will execute the scripts. The code in the example below opens a new writer document and insert some text. An instance of the class will start automatically even
if OOo is not up and running. Save the code in a file and name it test.vbs. Now, Open your command line and type: csript test.vbs
'The service manager is always the starting point
'If there is no office running then an office is started up
Set objServiceManager= WScript.CreateObject("com.sun.star.ServiceManager")
'Create the Desktop
Set objDesktop= objServiceManager.createInstance("com.sun.star.frame.Desktop")
'Open a new empty writer document
Set objDocument= objDesktop.loadComponentFromURL("private:factory/swriter",_ "_blank", 0, args)
'Create a text object
Set objText= objDocument.getText
'Create a cursor object
Set objCursor= objText.createTextCursor
'Inserting some Text
objText.insertString objCursor, "The first line in the newly created text document."&_ vbLf, false
Fore more information please check this link.
I hope this helpful.