Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
i need an help to improve a macro to export a table to Calc,the OpenOffice program.
I've found this macro that open a Calc window and copy a table to clipboardsub
Dim noSM
Dim oDesk
Dim oDoc
Dim aNoArgs()
Set oSM = CreateObject("com.sun.star.ServiceManager")
Set oDesk=oSM.createInstance("com.sun.star.frame.Desktop")
Set oDoc = oDesk.loadComponentFromURL("private:factory/scalc", "_blank", 0, aNoArgs)
ActiveDocument.GetSheetObject("CH01").CopyTableToClipboard true
end sub
I don't know how to paste my table "CH01" in Calc.
This is the BASIC macro to paste the table but in qv it doesn't work
sub paste
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$D$9"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())
end sub
hi,
How about this: clicking the "Export to Excel" icon on various QV objects will download an .XLS file . By default that opens with Excel.
If your users have OpenOffice installed instead of MS Office, XLS files will open with OpenOffice
-Alex
hi,
thank you for the answer, but i want create active button to export more than one chart in one time, so i need how to paste....
Hi, to export by macro a table/pivot to an openoffice/libreoffice calc i have used the usual "obj.ExportBiff "C:\.."" that use the microsoft excel dll. So to have the same dll i have tried to install microsoft ExcelViewer (that it's license free) and so the macro works perfectly. After you can also open the file.xls in a open calc program as usual..
Hope to help you
Dear Luca,
Did you find the macro code to paste the table?
Thank you.