1 Reply Latest reply: Aug 16, 2012 8:39 AM by Wojciech Parzyszek RSS

    how to export sheet object to open office?


      I want to export sheet object to open office.I have a button which will export sheet to open office  

      CAn anyone help me with macros?




        • Re: how to export sheet object to open office?

          this code could help you:



          Sub texttoopendoc()


          'The service manager is always the starting point

          'If there is no office running then an office is started up

          Set objServiceManager= CreateObject("com.sun.star.ServiceManager")

          'Create the Desktop

          Set objDesktop= objServiceManager.createInstance("com.sun.star.frame.Desktop")

          'Open a new empty writer document

          Dim args()

          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


          End Sub