Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to export sheet object to open office?

hi

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?

1 Reply
Not applicable
Author

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